From afa5936bb03d4bb139fb0ada03b6d1be3837e49e Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Fri, 26 Jan 2024 01:07:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=B1=87=E7=8E=87=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E6=A8=A1=E4=BB=BF=E4=BB=B7=E6=A0=BC=E4=B8=8D=E6=94=B9?= =?UTF-8?q?=E5=8F=98=E5=8E=9F=E5=9B=A0=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/magic-list/magic-list.vue | 17 ++++++++++++----- pages/index/index.vue | 5 ++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/components/magic-list/magic-list.vue b/components/magic-list/magic-list.vue index 6b8ef718..63c9d8eb 100644 --- a/components/magic-list/magic-list.vue +++ b/components/magic-list/magic-list.vue @@ -45,6 +45,12 @@ const app = getApp(); export default { name: 'recommend-hot', + data() { + return { + theme_view: app.globalData.get_theme_value_view(), + data_goods_list: [], + }; + }, props: { propCurrencySymbol: { type: String, @@ -65,11 +71,12 @@ default: 1000, }, }, - data() { - return { - theme_view: app.globalData.get_theme_value_view(), - data_goods_list: [], - }; + // 属性值改变监听 + watch: { + // 数据 + propData(value, old_value) { + this.set_data(value); + } }, mounted() { this.set_data(this.propData); diff --git a/pages/index/index.vue b/pages/index/index.vue index 7c21f7ae..78712cbe 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -162,7 +162,7 @@ - + @@ -328,6 +328,8 @@ cart_total: 0, message_total: 0, right_icon_list: [], + // 增加随机数,避免无法监听数据列表内部数据更新 + random_value: 0, // 基础配置 common_shop_notice: null, home_index_floor_data_type: 0, @@ -524,6 +526,7 @@ cart_total: data.cart_total.buy_number || 0, message_total: parseInt(data.message_total || 0), right_icon_list: data.right_icon_list || [], + random_value: Math.random(), data_list_loding_status: data.data_list.length == 0 ? 0 : 3, plugins_sort_list: data.plugins_sort_list || [], plugins_seckill_data: data.plugins_seckill_data || null,