dl_uniapp/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue

207 lines
3.9 KiB
Vue
Raw Normal View History

2025-03-18 17:41:45 +08:00
<template>
<view class="uni-popup-share">
2025-04-02 18:34:15 +08:00
<!-- <view class="uni-share-title"><text class="uni-share-title-text">{{shareTitleText}}</text></view> -->
2025-03-18 17:41:45 +08:00
<view class="uni-share-content">
<view class="uni-share-content-box">
2025-03-31 14:31:41 +08:00
<view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index"
@click.stop="select(item,index)">
<button v-if="'wx'==item.name" class="share-button" open-type="share" plain="true"></button>
2025-03-18 17:41:45 +08:00
<image class="uni-share-image" :src="item.icon" mode="aspectFill"></image>
<text class="uni-share-text">{{item.text}}</text>
</view>
</view>
</view>
<view class="uni-share-button-box">
<button class="uni-share-button" @click="close">{{cancelText}}</button>
</view>
</view>
</template>
<script>
import popup from '../uni-popup/popup.js'
import {
2025-03-31 14:31:41 +08:00
initVueI18n
2025-03-18 17:41:45 +08:00
} from '@dcloudio/uni-i18n'
import messages from '../uni-popup/i18n/index.js'
2025-03-31 14:31:41 +08:00
const {
t
} = initVueI18n(messages)
2025-03-18 17:41:45 +08:00
export default {
name: 'UniPopupShare',
2025-03-31 14:31:41 +08:00
mixins: [popup],
emits: ['select'],
2025-03-18 17:41:45 +08:00
props: {
title: {
type: String,
default: ''
},
beforeClose: {
type: Boolean,
default: false
}
},
data() {
return {
bottomData: [{
text: '微信',
2025-04-07 16:50:57 +08:00
icon: '/static/detail/weixin.png',
2025-03-18 17:41:45 +08:00
name: 'wx'
},
2025-04-10 16:11:09 +08:00
// {
// text: '海报',
// icon: '/static/detail/haibao.png',
// name: 'hb'
// },
2025-03-18 17:41:45 +08:00
{
2025-03-31 14:31:41 +08:00
text: '举报',
2025-04-07 16:50:57 +08:00
icon: '/static/detail/jubao.png',
2025-03-31 14:31:41 +08:00
name: 'jb'
2025-03-18 17:41:45 +08:00
},
// {
2025-03-31 14:31:41 +08:00
// text: '新浪',
// icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/0dacdbe0-50bf-11eb-8ff1-d5dcf8779628.png',
// name: 'sina'
// },
// {
2025-03-18 17:41:45 +08:00
// text: '百度',
// icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/1ec6e920-50bf-11eb-8a36-ebb87efcf8c0.png',
// name: 'copy'
// },
// {
// text: '其他',
// icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/2e0fdfe0-50bf-11eb-b997-9918a5dda011.png',
// name: 'more'
// }
]
}
},
created() {},
computed: {
cancelText() {
return t("uni-popup.cancel")
},
2025-03-31 14:31:41 +08:00
shareTitleText() {
2025-03-18 17:41:45 +08:00
return this.title || t("uni-popup.shareTitle")
}
},
methods: {
/**
* 选择内容
*/
select(item, index) {
this.$emit('select', {
item,
index
})
this.close()
},
/**
* 关闭窗口
*/
close() {
2025-03-31 14:31:41 +08:00
if (this.beforeClose) return
2025-03-18 17:41:45 +08:00
this.popup.close()
}
}
}
</script>
2025-03-31 14:31:41 +08:00
<style lang="scss">
button[plain] {
border: 0
}
.share-button {
position: absolute;
width: 100rpx;
height: 100rpx;
}
2025-03-18 17:41:45 +08:00
.uni-popup-share {
background-color: #fff;
border-top-left-radius: 11px;
border-top-right-radius: 11px;
}
2025-03-31 14:31:41 +08:00
2025-03-18 17:41:45 +08:00
.uni-share-title {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
height: 40px;
}
2025-03-31 14:31:41 +08:00
2025-03-18 17:41:45 +08:00
.uni-share-title-text {
font-size: 14px;
color: #666;
}
2025-03-31 14:31:41 +08:00
2025-03-18 17:41:45 +08:00
.uni-share-content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: center;
padding-top: 10px;
}
.uni-share-content-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
flex-wrap: wrap;
2025-03-31 14:31:41 +08:00
width: 100%;
2025-03-18 17:41:45 +08:00
}
.uni-share-content-item {
2025-03-31 14:31:41 +08:00
position: relative;
flex: 1;
2025-03-18 17:41:45 +08:00
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
padding: 10px 0;
align-items: center;
}
.uni-share-content-item:active {
2025-03-31 14:31:41 +08:00
pointer-events: none;
2025-03-18 17:41:45 +08:00
background-color: #f5f5f5;
2025-03-31 14:31:41 +08:00
position: relative;
2025-03-18 17:41:45 +08:00
}
.uni-share-image {
width: 30px;
height: 30px;
}
.uni-share-text {
2025-03-31 14:31:41 +08:00
z-index: 999;
2025-03-18 17:41:45 +08:00
margin-top: 10px;
font-size: 14px;
color: #3B4144;
}
.uni-share-button-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
padding: 10px 15px;
}
.uni-share-button {
flex: 1;
border-radius: 50px;
color: #666;
font-size: 16px;
}
.uni-share-button::after {
border-radius: 50px;
}
2025-03-31 14:31:41 +08:00
</style>