Inndy / vue-clipboard2

A simple vue2 binding to clipboard.js

Home Page:https://vue-clipboard2.inndy.tw/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

手机端,无法使用,我所测试的有小米,iPhone10

songlin1994 opened this issue · comments

使用的是官网例子Sample 2

一样

+1,华为,ios,都不行

开发者也不看那....

commented

It works on my iPhone 8 (with iOS 13.1.3 and Safari).

Please notice that samples use Cloudflare CDN to load Vue.js and it might be blocked by GFW.

I can't help without error message from developer console.

开发者也不看那....
什么意思……

Maybe it dosen't match the new version of android or IOS. So i use https://clipboardjs.com/
it works on some platform but not all. But it's better than this plugin. And the if the plugin not work on platform. I tell the users to copy by himself.

也许与Android或IOS的新版本不匹配。所以我用 https://clipboardjs.com/
它可以在某些平台上运行,但不是全部。但这比这个插件更好。并且如果插件在平台上不起作用。我告诉用户自己复制。

同样的状况 PC端复制正常 所有移动端都会直接进入错误分支 看来是通病了

同样的状况 PC端复制正常 所有移动端都会直接进入错误分支 看来是通病了

同样的问题

我采用了这种方式, 来解决问题:

this.$copyText(pendingCopyValue).then((suc) => {
    console.log('复制成功!');
}, (err) => {
    if(err && typeof err === 'object' && err.hasOwnProperty('action') && err.hasOwnProperty('text')) {
        console.log('复制成功!');
    } else {
        console.log('复制失败, 请稍后重试!');
    }
});

同样的状况 PC端复制正常 所有移动端都会直接进入错误分支 看来是通病了

同样的问题

我采用了这种方式, 来解决问题:

this.$copyText(pendingCopyValue).then((suc) => {
    console.log('复制成功!');
}, (err) => {
    if(err && typeof err === 'object' && err.hasOwnProperty('action') && err.hasOwnProperty('text')) {
        console.log('复制成功!');
    } else {
        console.log('复制失败, 请稍后重试!');
    }
});

但是实际上是复制失败的,黏贴版上并没有文字

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>vue-clipboard2 sample app</title>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.2.6/vue.js"></script>
  <script src="../dist/vue-clipboard.js"></script>
</head>
<body>
  <div id="app"></div>

  <template id="t">
    <div class="container">
    <input type="text" v-model="message">
    <button type="button" @click="doCopy">Copy!</button>
    </div>
  </template>

  <script>
  new Vue({
    el: '#app',
    template: '#t',
    data: function () {
      return {
        message: 'Copy These Text'
      }
    },
    methods: {
      doCopy: function () {
		let that = this
	   // 请求后端接口,等待返回参数,再进行copy,会copy失败,例如:
	   that.api.get('api/getUserName').then(res=>{
	   
		that.$copyText(res.userName).then(function (e) {
          alert('Copied')
          console.log(e)
        }, function (e) {
          alert('Can not copy')
          console.log(e)
        })
		
	   })
      }
    }
  })
  </script>
</body>
</html>