No uniapp, existem algumas dicas nativas para lidar com as interações, e você pode simplesmente compartilhar duas: uma é clicar na imagem para ver a imagem grande, que pode ser salva, etc., e a outra é chamar um mapa externo.
Se você estiver satisfeito, por favor, dê uma estrela a Mo Chengchen
Clique para ver a imagem grande (copie e cole o código a ser usado)
<template>
<view class="Box-Wrap">
<view class="IStitles">
<view class="toptitle Names">客服二维码</view>
<view class="Image">
<image class="image" @click="previewImage" src="https://cdn.uviewui.com/uview/common/logo.png"></image>
</view>
</view>
<view class="IStitles">
<view class="toptitle Names" @click="openLocation">点击调用外部地图</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
previewImage(e) {
wx.previewImage({
current: 'https://cdn.uviewui.com/uview/common/logo.png',
urls: ['https://cdn.uviewui.com/uview/common/logo.png'] //一个数组,可以查看多张图
});
},
openLocation() {
//外部地图
const _this = this;
let latitude = 39.13; //天津经纬度
let longitude = 117.2; //天津经纬度
let name = '天津';
let address = '可以是一段很长的地址介绍';
wx.openLocation({
name,
address,
latitude,
longitude,
scale: 18
});
},
}
};
</script>
<style lang="scss" scoped>
// @import "index.css"
.IStitles {
width: 92%;
margin-left: 4%;
min-height: 10rpx;
.toptitle {
display: inline-block;
height: 18rpx;
font-size: 36rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 550;
color: #333333;
line-height: 0;
background: linear-gradient(270deg, rgba(103, 159, 255, 0) 0%, #679fff 100%);
width: auto;
}
.Image {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
.image {
width: 320rpx;
height: 320rpx;
}
}
}
</style>
Informações adicionais e úteis que podem aparecer foram anotadas
Se você tiver alguma dúvida sobre o uniapp ou não entender este método, pode deixar uma mensagem, responderei o mais breve possível e ajudarei a resolvê-lo.