uniapp+vue3的ifdef实现多端配置客服消息

在微信小程序预览,实现客服消息,因是个人版,不支持

button | uni-app官网 (dcloud.net.cn)

条件编译处理多端差异 | uni-app官网 (dcloud.net.cn)

uni.makePhoneCall(OBJECT) | uni-app官网 (dcloud.net.cn)

javascript 复制代码
//my.vue
<template>
<view class="list">
			<view class="section">
				<view class="row">
					<view class="left">
						<uni-icons class="symbel" type="download-filled" size="20" color="#21b589"></uni-icons>
						<text>我的下载</text>
					</view>
					<view class="right">
						<text>0</text>
						<uni-icons type="right" class="arrow_right" size="15" color="#a9a9a9"></uni-icons>
					</view>
				</view>
				<view class="row">
					<view class="left">
						<uni-icons class="symbel" type="star-filled" size="20" color="#21b589"></uni-icons>
						<text>我的评分</text>
					</view>
					<view class="right">
						<text>0</text>
						<uni-icons type="right" class="arrow_right" size="15" color="#a9a9a9"></uni-icons>
					</view>
				</view>
				<view class="row">
					<view class="left">
						<uni-icons class="symbel" type="person-filled" size="20" color="#21b589"></uni-icons>
						<text>联系客服</text>
						<!-- 仅出现在 MP 平台下的代码 -->
						<!-- #ifdef MP -->
						<button open-type="contact" class="contect_with">联系客服</button>
						<!-- #endif -->
						<!-- 仅出现在 H5 平台下的代码 -->
						<!-- #ifdef H5-->
						<button @click="clickContact" class="contect_with">拨打电话</button>
						<!-- #endif -->
					</view>
					<view class="right">
						<text>0</text>
						<uni-icons class="arrow_right" type="right" size="15" color="#a9a9a9"></uni-icons>
					</view>
				</view>
				
			</view>
		</view>
</template>
<script setup>
// 拨打电话
	const clickContact=()=>{
		uni.makePhoneCall({
			phoneNumber:'13047585784'
		})
	}
</script>
<style lang="scss" scoped>
.list{
		width: 690rpx;
		margin: 0 30rpx 30rpx;
		border: 1rpx solid #eee;
		box-shadow: 0 0 30rpx rgba(0,0,0,0.05);//阴影
		border-radius: 10rpx;
		.section{
			.row{
				display: flex;
				justify-content: space-between;
				// align-items: center;
				height: 100rpx;
				border-bottom: 1px solid #eee;
				position: relative;
				&:last-child{
					border-bottom: 0 ;
				}
				.left{
					display: flex;
					align-items: center;
					color: #595959;
					.symbel{
						margin: 0 30rpx;
					}
					.contect_with{
						position: absolute;
						left: 0;
						top: 0;
						width: 100%;
						height: 100rpx;
						opacity: 0;
					}
				}
				.right{
					display: flex;
					align-items: center;
					color: #a9a9a9;
					.arrow_right{
						margin-right: 30rpx;
					}
				}
				
			}
		}
	}
</style>
相关推荐
Mintopia4 分钟前
Three.js 物理引擎:给你的 3D 世界装上 “牛顿之魂”
前端·javascript·three.js
Jeremy_Lee1237 分钟前
grafana 批量视图备份及恢复(含数据源)
前端·网络·grafana
import_random13 分钟前
[python]conda
前端
亲亲小宝宝鸭14 分钟前
写了两个小需求,终于搞清楚了表格合并
前端·vue.js
BUG收容所所长16 分钟前
栈的奇妙世界:从冰棒到算法的华丽转身
前端·javascript·算法
令狐寻欢21 分钟前
JavaScript中常用的设计模式
javascript
xingba24 分钟前
重写IE的showModalDialog模态框以兼容现代浏览器
前端·javascript·google
前端小巷子24 分钟前
Promise 静态方法:轻松处理多个异步任务
前端·面试·promise
梨子同志30 分钟前
JavaScript Set 和 Map 数据结构
前端·javascript
令狐寻欢31 分钟前
JavaScript中常用的数据结构与算法
javascript