增加公共分享组件
This commit is contained in:
@@ -44,6 +44,9 @@ page,
|
|||||||
image {
|
image {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
.relative{
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
.absolute{
|
.absolute{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|||||||
28
components/ymf-components/ymf-share.vue
Normal file
28
components/ymf-components/ymf-share.vue
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<template>
|
||||||
|
<view class="relative">
|
||||||
|
<slot v-if="$slots.default" name="default"></slot>
|
||||||
|
<up-icon v-else name="share-square" bold color="#333" size="36rpx"></up-icon>
|
||||||
|
<view class="absolute share-box">
|
||||||
|
<button open-type="share" @click="shareClick">分享</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
const emits = defineEmits(['shareClick'])
|
||||||
|
|
||||||
|
function shareClick() {
|
||||||
|
emits('shareClick')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.share-box {
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
top: 0;
|
||||||
|
opacity: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
"easycom": {
|
"easycom": {
|
||||||
"autoscan": true,
|
"autoscan": true,
|
||||||
"custom": {
|
"custom": {
|
||||||
|
"^my-(.*)": "@/components/ymf-components/ymf-$1.vue",
|
||||||
"^u--(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue",
|
"^u--(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue",
|
||||||
"^up-(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue",
|
"^up-(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue",
|
||||||
"^u-([^-].*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue"
|
"^u-([^-].*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue"
|
||||||
|
|||||||
@@ -13,8 +13,10 @@
|
|||||||
<up-swiper :list="goods.images" @change="swiperChange" :current="swiperCurrent" radius="6px"
|
<up-swiper :list="goods.images" @change="swiperChange" :current="swiperCurrent" radius="6px"
|
||||||
height="250" @click="prveImgs(goods.images, goods.images[swiperCurrent])">
|
height="250" @click="prveImgs(goods.images, goods.images[swiperCurrent])">
|
||||||
</up-swiper>
|
</up-swiper>
|
||||||
|
<view class="shop_sku_name u-flex u-row-between">
|
||||||
<view class="shop_sku_name">{{ goods.name }}</view>
|
<view class="u-line-1" style="max-width: 600rpx;">{{ goods.name }}</view>
|
||||||
|
<ymfShare />
|
||||||
|
</view>
|
||||||
<view class="shop_sku_description" v-if="isSkuGoods">
|
<view class="shop_sku_description" v-if="isSkuGoods">
|
||||||
{{ goods.shortTitle ? goods.shortTitle : '' }}
|
{{ goods.shortTitle ? goods.shortTitle : '' }}
|
||||||
</view>
|
</view>
|
||||||
@@ -308,6 +310,7 @@
|
|||||||
import {
|
import {
|
||||||
useNavbarStore
|
useNavbarStore
|
||||||
} from '@/stores/navbarStore';
|
} from '@/stores/navbarStore';
|
||||||
|
import ymfShare from '@/components/ymf-components/ymf-share.vue'
|
||||||
const store = useNavbarStore();
|
const store = useNavbarStore();
|
||||||
const {
|
const {
|
||||||
showBack,
|
showBack,
|
||||||
@@ -479,11 +482,11 @@
|
|||||||
const swiperCurrent = ref(0);
|
const swiperCurrent = ref(0);
|
||||||
|
|
||||||
function returnFirstSku(product) {
|
function returnFirstSku(product) {
|
||||||
console.log('returnFirstSku', product.skuList[0]);
|
console.log('returnFirstSku', product);
|
||||||
return {
|
return {
|
||||||
...product.skuList[0],
|
...product.skuList[0]||'',
|
||||||
sku_id: product.skuList[0].id,
|
sku_id: product.skuList[0].id||'',
|
||||||
id: product.id,
|
id: product.id||'',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//返回是否是多规格商品
|
//返回是否是多规格商品
|
||||||
@@ -831,7 +834,7 @@
|
|||||||
padding: 0 28rpx;
|
padding: 0 28rpx;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 32upx;
|
font-size: 32rpx;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1445,7 +1445,11 @@
|
|||||||
// showShopsku.value = true;
|
// showShopsku.value = true;
|
||||||
goodsModalList.value.push({
|
goodsModalList.value.push({
|
||||||
show:true,
|
show:true,
|
||||||
goods:specifications.item
|
goods:{
|
||||||
|
...specifications.item,
|
||||||
|
/*过滤掉只有一个规格且下架的商品或者skuList为空的商品*/
|
||||||
|
relatedRecommendJson:(specifications.item.relatedRecommendJson||[]).filter(v=>v.skuList&&v.skuList.length)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
// 判断商品是否在可售时间内
|
// 判断商品是否在可售时间内
|
||||||
|
|||||||
@@ -240,10 +240,10 @@ export const shareMixin = {
|
|||||||
...defaultShareConfig,
|
...defaultShareConfig,
|
||||||
...pageShareConfig
|
...pageShareConfig
|
||||||
})
|
})
|
||||||
return {
|
return wxShare({
|
||||||
...defaultShareConfig,
|
...defaultShareConfig,
|
||||||
...pageShareConfig
|
...pageShareConfig
|
||||||
};
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@@ -289,9 +289,9 @@ export const shareMixin = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const pageTimelineConfig = this.$options.shareTimelineConfig || {};
|
const pageTimelineConfig = this.$options.shareTimelineConfig || {};
|
||||||
return {
|
return wxShare({
|
||||||
...defaultTimelineConfig,
|
...defaultTimelineConfig,
|
||||||
...pageTimelineConfig
|
...pageTimelineConfig
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user