1. Copy link
Main function code: document.execCommand('Copy');
copy() {
console.log('复制');
var inputTest = document.createElement('input');
inputTest.value = this.copyUrl;
// inputTest.value='11111111111';
document.body.appendChild(inputTest);
inputTest.select();
document.execCommand('Copy');
uni.showToast({
title: '复制成功',
icon: 'none'
});
},
2. File preview
Requirements: It needs to be displayed in the pop-up box, so it must be able to be nested into the ui component, and it should be opened on this page without jumping to a new page
So the iframe tag used
<u-popup :show="show_three" :round="10" :zIndex="zIndex_three" style='padding: 40rpx;' @close="close_three" >
<view class="popup_three" >
<view class="title">文件预览</view>
<iframe :src="copyUrl" width='100%' height='400rpx'></iframe></view>
</u-popup>
The web-view used at the beginning
But it cannot be nested into other ui components, so it does not meet the requirements
<template v-if='show_three'>
<view class="" style="padding: 20rpx;">
<web-view :src="copyUrl" ></web-view>
</view>
</template>
3. File download