<template>
<view class="text" @click="copyText" style="color: #0081FF">{{ msg }}</view>
<view class="wrap">
<textarea :auto-height="true">
</view>
</template>
export default {
data() {
return {
msg: 'copycopycopycopycopycopycopycopycopycopycopycopycopycopy'
}
},
methods: {
copyText() {
const text = this.msg;
if (text) {
uni.setClipboardData({
data: text,
success: (e) => {
console.log('success', e);
},
fail: (err) => {
console.log('fail',err);
}
});
}
}
}
}
.wrap {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
border: 2rpx solid red;
background: #D2F1F0;
textarea {
margin: 30rpx;
}
}
当前页面page.json
{
"path" : "pages/test/test",
"style": {
"app-plus": {
"softinputMode": "adjustResize"
}
}
}