1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <template>
- <view class="container all-type-list-wrapper">
- <product-list ref="childList" :empty-text="emptyText" :serverUrl="serverUrl" :classifyID="classifyID" v-if="isRequest"></product-list>
- </view>
- </template>
- <script>
- import productList from '@/components/cm-module/listTemplate/classifyProductList'
-
- export default{
- components:{
- productList
- },
- data(){
- return{
- serverUrl: '',
- emptyText: '该分类暂时还没有商品哟,去逛逛别的吧~',
- lastPageType: '',
- lastPageVal: '',
- isRequest:false,
- classifyID:null
- }
- },
- onLoad(option) {
- let self = this;
- self.setServerUrl(option);
- },
- methods:{
- setServerUrl(option) {
- let self = this;
- const {type, from: value} = option;
- this.lastPageType = type;
- this.lastPageVal = value;
- uni.setNavigationBarTitle({title:value});
- uni.getStorage({
- key: 'commodity_id',
- success: function (res) {
- self.classifyID = res.data;
- self.isRequest = true
- }
- })
- }
- },
- onShow() {
- let pages = getCurrentPages(),
- thisPage = pages[pages.length - 1];
- if(thisPage.refresh) {
- this.setServerUrl(thisPage.listData);
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- background: $sub-bg-color;
- .all-type-list-wrapper {
- display: flex;
- flex-direction: column;
- }
- }
- </style>
|