click copy

https://www.npmjs.com/package/vue-clipboard2

   <p>{{message2}}</p>
   <button type="button" @click="doCopy('add me!')">Copy!</button>
   
   
     dataProcessing (val) {
        this.message2 = this.message2 + ' ' + val
      },
      doCopy: function (val) {
        this.dataProcessing(val)
        this.$copyText(this.message2).then(function (e) {
            console.log(e)
            alert('Copied='+ e.text)
        }, function (e) {
           alert('Can not copy',e.text)
           console.log(e)
        })
      }


    methods: {
        handleCopyLink (link) {
            this.$copyText(link).then((e) => {
                this.$message.success('复制成功!');
            }, (e) => {
                this.$message.error('复制失败!');
            });
        },

        handleClose () {
            this.$emit('close');
        }
    }

refs



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


相关文章:

  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
  • 2021-07-12
  • 2021-10-15
  • 2021-04-25
猜你喜欢
  • 2021-09-27
  • 2021-11-19
  • 2022-12-23
  • 2021-09-17
  • 2021-10-31
  • 2021-04-28
  • 2022-12-23
相关资源
相似解决方案