浏览器一键复制
html:
<div class="common_btn" @click="copyText"> {{ $t('common.copyText') }} div>
js:
copyText() { let oInput = document.createElement('input'); oInput.value = this.form.tagSn;//复制内容 document.body.appendChild(oInput); oInput.select(); document.execCommand("Copy"); oInput.style.display = 'none'; this.$message.success(this.$t('common.copyText') + this.$t('common.success'))//成功提示 }