feat: 增加复制功能
This commit is contained in:
@@ -70,6 +70,8 @@ import { createWeb
|
||||
} from '@/api/autoCode'
|
||||
import {ref} from 'vue'
|
||||
import WarningBar from '@/components/warningBar/warningBar.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
|
||||
defineOptions({
|
||||
name: 'Picture'
|
||||
@@ -91,6 +93,24 @@ const handleKeydown = (event) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 复制方法:把某个字符串写进剪贴板
|
||||
const copySnippet = (htmlString) => {
|
||||
navigator.clipboard.writeText(htmlString)
|
||||
.then(() => {
|
||||
ElMessage({
|
||||
message: '复制成功',
|
||||
type: 'success',
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
ElMessage({
|
||||
message: '复制失败',
|
||||
type: 'warning',
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const prompt = ref('')
|
||||
|
||||
// 判断是否返回的标志
|
||||
|
Reference in New Issue
Block a user