Commit af24efd4 authored by yaya's avatar yaya

feat:去除less

parent a7426a65
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</el-dialog> </el-dialog>
<LamaImageDialog <LamaImageDialog
:show-lama-dialog="showLamaImageDialog" :show-lama-dialog="showLamaImageDialog"
@imageBase64="handleGetImageBase64"/> @imageBase64="handleGetImageBase64" />
</div> </div>
</template> </template>
...@@ -69,6 +69,12 @@ export default { ...@@ -69,6 +69,12 @@ export default {
} }
debugger debugger
if (this.selectType === 1) { // 去水印 if (this.selectType === 1) { // 去水印
const result = this.copyContent(this.imageList[this.currentPosition])
if (result) {
this.$message.info('复制链接成功,粘贴去链接去水印吧')
} else {
this.$message.error('复制链接失败,请重试')
}
this.showLamaImageDialog = true this.showLamaImageDialog = true
} else { } else {
this.$emit('selectSuccess', this.imageList[this.currentPosition]) this.$emit('selectSuccess', this.imageList[this.currentPosition])
...@@ -79,14 +85,62 @@ export default { ...@@ -79,14 +85,62 @@ export default {
this.$emit('imageBase64Str', imgUrlBase64) this.$emit('imageBase64Str', imgUrlBase64)
this.showLamaImageDialog = false this.showLamaImageDialog = false
this.$emit('closeDialog') this.$emit('closeDialog')
},
copyContent(content) {
// 复制结果
let copyResult = true
// 设置想要复制的文本内容
const text = content || ''
// 判断是否支持clipboard方式
if (window.navigator.clipboard) {
// 利用clipboard将文本写入剪贴板(这是一个异步promise)
window.navigator.clipboard.writeText(text).then((res) => {
console.log('复制成功')
// 返回复制操作的最终结果
return copyResult
}).catch((err) => {
copyResult = false
console.log('复制失败', err)
// 返回复制操作的最终结果
return copyResult
})
} else {
// 不支持clipboard方式 则采用document.execCommand()方式
// 创建一个input元素
const inputDom = document.createElement('textarea')
// 设置为只读 防止移动端手机上弹出软键盘
inputDom.setAttribute('readonly', 'readonly')
// 给input元素赋值
inputDom.value = text
// 将创建的input添加到body
document.body.appendChild(inputDom)
// 选中input元素的内容
inputDom.select()
// 执行浏览器复制命令
// 复制命令会将当前选中的内容复制到剪切板中(这里就是创建的input标签中的内容)
// Input要在正常的编辑状态下原生复制方法才会生效
const result = document.execCommand('copy')
// 判断是否复制成功
if (result) {
console.log('复制成功')
} else {
console.log('复制失败')
copyResult = false
}
// 复制操作后再将构造的标签 移除
document.body.removeChild(inputDom)
// 返回复制操作的最终结果
return copyResult
}
} }
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="scss" scoped>
.list { .list {
width: 720px; width: 720px;
.select_item { .select_item {
width: 100px; width: 100px;
height: 100px; height: 100px;
...@@ -99,6 +153,7 @@ export default { ...@@ -99,6 +153,7 @@ export default {
width: 100px; width: 100px;
height: 100px; height: 100px;
} }
.check_img { .check_img {
position: absolute; position: absolute;
top: 10px; top: 10px;
......
...@@ -468,7 +468,7 @@ export default { ...@@ -468,7 +468,7 @@ export default {
} }
</script> </script>
<style lang="less" scoped> <style lang="scss" scoped>
/deep/ .vue-picture-cut_default-menu { /deep/ .vue-picture-cut_default-menu {
height: 0px; height: 0px;
inset: 0px 0px 0px !important; inset: 0px 0px 0px !important;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment