uniapp点击按钮复制链接


<text style="color: #0075F7;">{{completeUrl}}</text>
<u-button type="primary" @click="copyUrl(completeUrl)">复制URL</u-button>

  

        copyUrl(url) {
                uni.showModal({
                    content: url,
                    confirmText: '复制内容',
                    success: () => {
                        uni.setClipboardData({
                            data: url,
                            success: function() {
                                uni.hideToast({
                                    title: '复制成功',
                                    duration: 2000,
                                    icon: 'none'
                                });
                            },
                            fail: function(err) {
                                uni.showToast({
                                    title: '复制失败',
                                    duration: 2000,
                                    icon: 'none'
                                });
                            }
                        });
                    }
                });
            },

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM