jq+vue 使用clipboard实现复制内容到剪切板

<extend name="Base/common_new"/>
<block name="style">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</block>

<block name="body">
    <style>

        #container {
            margin-left: 180px;
            padding: 25px;
        }

        .title-top {
            height: 80px;
            line-height: 80px;
            padding-left: 30px;
            background-color: #fff;
            font-size: 24px;
            margin-bottom: 30px;
        }

        .content {
            padding: 0 20px;
            background-color: #fff;
            min-height: 70vh;
        }

        .search {
            display: flex;
            align-items: center;
            padding: 30px 0;
        }

        .gun-box {
            display: flex;
            justify-content: space-around;
            padding: 25px;
        }

        .gun-box .scan-txt{
            font-size: 24px;
            font-weight: bold;
        }

        .gun-box .scan-txt2{
            display: inline-block;
            margin: 13px 0;
        }

        .gun-box .el-button{
            width: 120px;
            float: right;
        }


    </style>
    <div id="app">
        <section id="container">
            <p class="title-top">扫码枪管理</p>
            <div class="content">
                <div class="">
                    <div class="gun-box">
                      
                        <div>                     
                            <el-button
                                    type="primary"
                                    v-clipboard:copy="ctccNo"
                                    v-clipboard:success="onCopy"
                                    v-clipboard:error="onError"
                            > 全部复制
                            </el-button>

                            <el-input
                                    type="textarea"
                                    class="copy"
                                    :rows="10"
                                    placeholder="请输入内容"
                                    v-model="ctccNo">
                            </el-input>
                        </div>
                    </div>
                </div>

            </div>


        </section>


    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script>
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>

    <!--引入复制js-->
    <script src="https://cdn.bootcdn.net/ajax/libs/vue-clipboard2/0.3.1/vue-clipboard.min.js"></script>

    <script>

        new Vue({
            el: '#app',
            data() {
                return {
                    // 表单数据
                    form: {},
                    iccid: '',
                    copy_iccid: '',
                    ctccNo: '',
                }
            },

            mounted() {

            },

            watch: {
            },

            filters: {
            },

            methods: {
                getData() {

                },

              
                // 复制内容成功回调
                onCopy(e) {
                    this.$message.success('复制成功')
                },
                // 复制内容错误回调
                one rror(e) {
                    this.$message.error('复制失败');
                },
            }

        })
    </script>

    <script type="text/javascript">
        $(function () {
            // $(".sub-menu:eq(5) > ul > li:eq(0) ").css('background', '#00c1de');
            // $(".sub-menu:eq(5) > a").trigger('click');
        });

    </script>
</block>

上一篇:使用flask+gunicorn+uginx进行项目部署


下一篇:Java小游戏中发射子弹的问题