# MyCopyButton

复制按钮

引入

  import MyCopyButton from '@/components/MyCopyButton';
1

注册组件

    export default {
        data()=>{
            return {
                url: 'https://m.baidu.com'
            }
        },
        components: {
            MyCopyButton
        }
    }
1
2
3
4
5
6
7
8
9
10

template里面使用

   <my-copy-button :copy-text="url">
      复制方案链接
   </my-copy-button>
1
2
3

# API

  • copy-text

字段含义: 复制内容
类型: String
默认: ''


  • disabled

字段含义: 文件地址
类型: Boolean
默认: false


# 说明

本组件调用了document.execCommand('Copy'),以实现复制功能。 兼容到: Chrome 42+, Firefox 41+, Safari 10+