cl-upload-space 添加复制资源地址功能

This commit is contained in:
icssoa 2021-07-05 13:59:48 +08:00
parent b010d35153
commit 0219448272
4 changed files with 41 additions and 12 deletions

View File

@ -1,6 +1,6 @@
{
"name": "front-next",
"version": "0.5.2",
"version": "0.5.3",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit --skipLibCheck && vite build",
@ -11,7 +11,7 @@
"dependencies": {
"array.prototype.flat": "^1.2.4",
"axios": "^0.21.1",
"cl-admin-crud-vue3": "^0.3.12",
"cl-admin-crud-vue3": "^0.3.14",
"clipboard": "^2.0.8",
"clone-deep": "^4.0.1",
"codemirror": "^5.60.0",

View File

@ -189,7 +189,12 @@ export default {
//
beforeUpload: Function,
//
beforeRemove: Function
beforeRemove: Function,
//
urlJoin: {
type: Boolean,
default: true
}
},
emits: ["update:modelValue", "change"],
@ -270,7 +275,7 @@ export default {
_urls() {
const format = {
image: ["bmp", "jpg", "jpeg", "png", "tif", "gif", "svg"]
image: ["bmp", "jpg", "jpeg", "png", "tif", "gif", "svg", "webp"]
};
return this.urls
@ -354,10 +359,12 @@ export default {
//
update() {
const urls = this.urls
.filter((e) => Boolean(e.url))
.map((e) => e.url)
.join(",");
let urls = this.urls.filter((e) => Boolean(e.url)).map((e) => e.url);
//
if (this.urlJoin) {
urls = urls.join(",");
}
this.$emit("update:modelValue", urls);
this.$emit("change", urls);

View File

@ -48,6 +48,8 @@
<script lang="ts">
import { computed, defineComponent, inject } from "vue";
import { ContextMenu } from "cl-admin-crud-vue3";
import { ElMessage } from "element-plus";
import Clipboard from "clipboard";
export default defineComponent({
name: "cl-upload-space-item",
@ -94,6 +96,26 @@ export default defineComponent({
function openContextMenu(e: any) {
ContextMenu.open(e, {
list: [
{
label: "复制地址",
callback: (e: any, done: Function) => {
const clipboard: any = new Clipboard(e.target, {
text: () => info.value.url
});
clipboard.on("success", () => {
ElMessage.success("复制成功");
clipboard.destroy();
});
clipboard.on("error", () => {
clipboard.destroy();
});
clipboard.onClick(e);
done();
}
},
{
label: isSelected.value ? "取消选中" : "选中",
"suffix-icon": isSelected.value ? "el-icon-close" : "el-icon-check",

View File

@ -930,10 +930,10 @@ change-case@^4.1.2:
optionalDependencies:
fsevents "~2.3.1"
cl-admin-crud-vue3@^0.3.12:
version "0.3.12"
resolved "https://registry.nlark.com/cl-admin-crud-vue3/download/cl-admin-crud-vue3-0.3.12.tgz#afbbb52711f8f6e032dcacbd22977c9fa58d8662"
integrity sha1-r7u1JxH49uAy3Ky9Ipd8n6WNhmI=
cl-admin-crud-vue3@^0.3.14:
version "0.3.14"
resolved "https://registry.nlark.com/cl-admin-crud-vue3/download/cl-admin-crud-vue3-0.3.14.tgz#b2463e60e5b999768a8b8e895436343c90c01e92"
integrity sha1-skY+YOW5mXaKi46JVDY0PJDAHpI=
dependencies:
array.prototype.flat "^1.2.4"
core-js "^3.6.5"