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>
相关推荐
2501_9102275412 分钟前
web3 前端常见错误类型以及错误捕获处理
前端·web3
哎哟喂_!1 小时前
Node.js 同步加载问题详解:原理、危害与优化策略
前端·chrome·node.js
__BMGT()1 小时前
C++ QT图片查看器
前端·c++·qt
陌路物是人非1 小时前
uniapp取消浏览自动填充
java·服务器·uni-app
OK_boom1 小时前
React-useRef
javascript·react.js·ecmascript
未来之窗软件服务1 小时前
solidwors插件 开发————仙盟创梦IDE
前端·javascript·数据库·ide·仙盟创梦ide
lqj_本人1 小时前
鸿蒙OS&UniApp实现视频播放与流畅加载:打造完美的移动端视频体验#三方框架 #Uniapp
uni-app·音视频·harmonyos
小白学大数据1 小时前
基于Scrapy-Redis的分布式景点数据爬取与热力图生成
javascript·redis·分布式·scrapy
Varpb2 小时前
【vue】【环境配置】项目无法npm run serve,显示node版本过低
前端·vue.js·npm
读心悦2 小时前
CSS 溢出内容处理、可见性控制与盒类型设置深度解析
前端·css