diff --git a/pages/template/long-list/long-list-page.uvue b/pages/template/long-list/long-list-page.uvue index f6fd505191b2ce80ec361b5f55886ccf47f481a3..777cbc7ee162e44fbf84478d664de39b57a2ae5f 100644 --- a/pages/template/long-list/long-list-page.uvue +++ b/pages/template/long-list/long-list-page.uvue @@ -56,6 +56,10 @@ type: { type: String, default: '' + }, + preload: { + type: Boolean, + default: false } }, data() { @@ -80,19 +84,18 @@ } } }, - mounted() { + created() { uni.loadFontFace({ global: false, family: 'UtsIconsFontFamily', source: '/static/fonts/icon-star.ttf' }) + + if (this.preload) { + this.loadData() + } }, methods: { - init() { - if (this.dataList.length == 0) { - this.loadData() - } - }, loadData() { if (this.loading || this.isEnded) { return diff --git a/pages/template/long-list/long-list.uvue b/pages/template/long-list/long-list.uvue index aa3a02dd5e09366bd78238a9222a3394609a8062..03d01faca05b52c75de8b4d8e9cec30ddf999278 100644 --- a/pages/template/long-list/long-list.uvue +++ b/pages/template/long-list/long-list.uvue @@ -22,7 +22,7 @@ - + @@ -40,7 +40,7 @@ type SwiperViewItem = { type : string, name : string, - init : Boolean, + preload : Boolean, } export default { @@ -53,7 +53,8 @@ swiperList: [ { type: 'UpdatedDate', - name: '最新上架' + name: '最新上架', + preload: true } as SwiperViewItem, { type: 'FreeHot', @@ -139,9 +140,9 @@ } }, initSwiperItemPage(index : Number) { - if (!this.swiperList[index].init) { - this.swiperList[index].init = true; - (this.$refs["longPage"] as ComponentPublicInstance[])[index].$callMethod('init') + if (!this.swiperList[index].preload) { + this.swiperList[index].preload = true; + (this.$refs["longPage"] as ComponentPublicInstance[])[index].$callMethod('loadData') } }, updateTabIndicator(left : Number, width : Number) {