mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2024-11-01 06:02:38 +08:00
cl-upload-space 添加复制资源地址功能
This commit is contained in:
parent
b010d35153
commit
0219448272
@ -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",
|
||||
|
@ -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);
|
||||
|
@ -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",
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user