<template> <view class="honour" :class="fromIndex ? '' : 'share'"> <view class="container"> <view class="certificate" @click="previewImage"> <image :src="url" mode="widthFix" style="width: 100%;"></image> </view> <view class="share"> <view class="item" @tap="saveImg"> <!-- <image class="icon" src="../../static/icon/share2.png"></image> --> <view>长按保存图片</view> </view> </view> </view> </view> </template> <script> export default { data() { return { url: '' }; }, methods: { previewImage() { uni.previewImage({ urls: [this.url], longPressActions: { itemList: ['保存图片'], success: function(data) { }, fail: function(err) { console.log(err.errMsg); } } }); } }, async onLoad(options) { this.url = options.path } }; </script> <style lang="scss"> .container { padding: 36rpx 54rpx; .certificate {} .item { text-align: center; // background: linear-gradient(91deg, #F30000 1%, #FE4815 99%); padding: 10px 0; border-radius: 6px; color: #F30000; font-size: 20px; } } </style>