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)

本文标签: 不成功回调器中vueError