import Taro, { Component } from '@tarojs/taro' import { View, Button, Text, Swiper, SwiperItem, Image } from '@tarojs/components' import { AtSearchBar, Picker } from 'taro-ui' import URL from '../../serviceAPI.config' import './shop.scss' class Shop extends Component { // 项目配置 config = { navigationBarTitleText: '店铺' } constructor() { super(...arguments) this.state = { value: '', shopId:'', shopName:'' } } onChange(value) { this.setState({ value: value }) } onActionClick() { console.log('开始搜索') } getShopInfo() { Taro.request({ url: URL.GoodsSearch, method:'POST', dataType: 'json', data:{ goods: JSON.stringify({ curr_page: 1, page_count: 50, shop_name: false, shop_id: 1254, config_id: 4, shop_class_id: '', order: 'g.browse_times desc', currPage: 1, goods_class_id: 10401 }), goodsRegion: JSON.stringify({}), goodsSpec: JSON.stringify([]), goodsParam: JSON.stringify([]), goodsParamExt: JSON.stringify([]), }, header: { 'content-type': 'application/x-www-form-urlencoded', 'X-Requested-With':'XMLHttpRequest' } }) .then(res => { console.log('res--',res) }) } componentWillMount() { this.setState({ shopId: this.$router.params.id, shopName: this.$router.params.name}) // 输出 { id: 2, type: 'test' } } componentDidMount(){ this.getShopInfo() } componentDidShow() { } componentDidHide() { } render() { const shopName= this.state.shopName console.log(shopName) return ( {shopName} 店铺全部分类 首页 店铺说明 ) } } export default Shop