Skip to content

Commit 750cc44

Browse files
committed
fix(view): 一键复制功能
1 parent c46aa26 commit 750cc44

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

admin/src/views/home/out.vue

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
<el-col :span="0">&nbsp;</el-col>
3535
</el-form-item>
3636
</el-form>
37+
<el-row>
38+
<el-col :span="4">&nbsp;&nbsp;</el-col>
39+
<el-col :span="4">
40+
<el-button @click="copyInput">一键复制输入内容</el-button>
41+
</el-col>
42+
<el-col :span="7">&nbsp;&nbsp;</el-col>
43+
<el-col :span="1"><el-button @click="copyOutput">一键复制输出内容</el-button></el-col>
44+
</el-row>
3745
</div>
3846
</template>
3947

@@ -60,6 +68,37 @@ export default {
6068
},
6169
created() {},
6270
methods: {
71+
copyInput() {
72+
const that = this
73+
that.$copyText(this.form.input).then(function(e) {
74+
that.$message({
75+
message: '输入内容复制成功',
76+
type: 'success'
77+
})
78+
}, function(e) {
79+
this.$message({
80+
message: '复制失败',
81+
type: 'error'
82+
})
83+
console.log(e)
84+
})
85+
},
86+
copyOutput() {
87+
const that = this
88+
this.$copyText(this.output).then(function(e) {
89+
that.$message({
90+
message: '输出内容复制成功',
91+
type: 'success'
92+
})
93+
// console.log(e)
94+
}, function(e) {
95+
this.$message({
96+
message: '复制失败',
97+
type: 'error'
98+
})
99+
console.log(e)
100+
})
101+
},
63102
onSubmit(form) {
64103
this.$refs[form].validate((valid) => {
65104
if (valid) {

0 commit comments

Comments
 (0)