admin管理员组文章数量:1534360
在谷歌浏览器是可以复制成功的,但在360安全浏览器(极速模式或兼容模式)复制不成功,浏览器都已更新到最新版本。 安装: npm install vue-clipboard2 --save-dev 在main.js文件中: import Vue from 'vue'; //引入复制插件 import VueClipboard from 'vue-clipboard2'; Vue.use(VueClipboard);
此问题未解决,代码如下:
- 在template标签中(此为循环创建的复制按钮):
<el-button class="btn-common copy-video-btns" type="primary" size="small" @click="copyVideoUrl(props.$index,props.row)">
<span>复制地址</span>
</el-button>
//input不在循环创建中
<input type="text" v-model="copyVideoUrlCont" style="opacity: 0;">
- 在script标签中:
data(){
return{
copyVideoUrlCont:''
}
},
methods:{
copyVideoUrl(index,row){
const thisObj = this;
//post请求,此为自己封装的
commonJsmObj.httpPost(this,url,params,function (res) {
thisObj.copyVideoUrlCont='';
thisObj.$notify.closeAll();
if(res.data.result.resultCode == responseCode.SUCCESS_FULLY)){
if(res.data.livePlayUrl){
thisObj.copyVideoUrlCont = res.data.livePlayUrl;
thisObj.$copyText(thisObj.copyVideoUrlCont).then(function (e) {
console.log('已复制');
console.log(e);
},function (e) {
console.log('复制失败');
console.log(e);
})
}
}
},function (error) {
commonJs.logger.debug(error);
})
}
注:https://www.npmjs/package/vue-clipboard2 (参考sample2)
版权声明:本文标题:vue中使用vue-clipboard2,在360安全浏览器中复制不成功,一直进入error回调 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1726882895a1088661.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论