diff --git a/src/pages/goods/goods.vue b/src/pages/goods/goods.vue index 089e069..5caabfe 100644 --- a/src/pages/goods/goods.vue +++ b/src/pages/goods/goods.vue @@ -30,7 +30,7 @@ 选择 - 请选择商品规格 + {{ selectArrText }} 送至 @@ -121,6 +121,12 @@ :mode="mode" add-cart-background-color="#FFA868" buy-now-background-color="#27BA9B" + ref="skuPopupRef" + :actived-style="{ + color: '#27BA9B', + borderColor: '#27BA9B', + backgroundColor: '#E9F8F5', + }" /> @@ -131,7 +137,10 @@ import type { GoodsResult } from '@/types/goods' import { getGoodsByIdAPI } from '@/services/goods' import AddressPanel from './components/AddressPanel.vue' import ServicePanel from './components/ServicePanel.vue' -import type { SkuPopupLocaldata } from '@/components/vk-data-goods-sku-popup/vk-data-goods-sku-popup' +import type { + SkuPopupInstance, + SkuPopupLocaldata, +} from '@/components/vk-data-goods-sku-popup/vk-data-goods-sku-popup' // 获取屏幕边界到安全区域距离 const { safeAreaInsets } = uni.getSystemInfoSync() @@ -223,6 +232,14 @@ const openSkuPopup = (val: SkuMode) => { // 修改按钮模式 mode.value = val } + +// SKU组件实例 +const skuPopupRef = ref() + +// 计算被选中的值 +const selectArrText = computed(() => { + return skuPopupRef.value?.selectArr?.join(' ').trim() || '请选择商品规格' +})