mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-16 08:38:48 +00:00
cl-upload-space 添加复制资源地址功能
This commit is contained in:
parent
b010d35153
commit
0219448272
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "front-next",
|
"name": "front-next",
|
||||||
"version": "0.5.2",
|
"version": "0.5.3",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit --skipLibCheck && vite build",
|
"build": "vue-tsc --noEmit --skipLibCheck && vite build",
|
||||||
@ -11,7 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"array.prototype.flat": "^1.2.4",
|
"array.prototype.flat": "^1.2.4",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"cl-admin-crud-vue3": "^0.3.12",
|
"cl-admin-crud-vue3": "^0.3.14",
|
||||||
"clipboard": "^2.0.8",
|
"clipboard": "^2.0.8",
|
||||||
"clone-deep": "^4.0.1",
|
"clone-deep": "^4.0.1",
|
||||||
"codemirror": "^5.60.0",
|
"codemirror": "^5.60.0",
|
||||||
|
|||||||
@ -189,7 +189,12 @@ export default {
|
|||||||
// 上传文件之前的钩子
|
// 上传文件之前的钩子
|
||||||
beforeUpload: Function,
|
beforeUpload: Function,
|
||||||
// 删除文件之前的钩子
|
// 删除文件之前的钩子
|
||||||
beforeRemove: Function
|
beforeRemove: Function,
|
||||||
|
// 是否拼接
|
||||||
|
urlJoin: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
emits: ["update:modelValue", "change"],
|
emits: ["update:modelValue", "change"],
|
||||||
@ -270,7 +275,7 @@ export default {
|
|||||||
|
|
||||||
_urls() {
|
_urls() {
|
||||||
const format = {
|
const format = {
|
||||||
image: ["bmp", "jpg", "jpeg", "png", "tif", "gif", "svg"]
|
image: ["bmp", "jpg", "jpeg", "png", "tif", "gif", "svg", "webp"]
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.urls
|
return this.urls
|
||||||
@ -354,10 +359,12 @@ export default {
|
|||||||
|
|
||||||
// 更新值
|
// 更新值
|
||||||
update() {
|
update() {
|
||||||
const urls = this.urls
|
let urls = this.urls.filter((e) => Boolean(e.url)).map((e) => e.url);
|
||||||
.filter((e) => Boolean(e.url))
|
|
||||||
.map((e) => e.url)
|
// 是否拼接
|
||||||
.join(",");
|
if (this.urlJoin) {
|
||||||
|
urls = urls.join(",");
|
||||||
|
}
|
||||||
|
|
||||||
this.$emit("update:modelValue", urls);
|
this.$emit("update:modelValue", urls);
|
||||||
this.$emit("change", urls);
|
this.$emit("change", urls);
|
||||||
|
|||||||
@ -48,6 +48,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, inject } from "vue";
|
import { computed, defineComponent, inject } from "vue";
|
||||||
import { ContextMenu } from "cl-admin-crud-vue3";
|
import { ContextMenu } from "cl-admin-crud-vue3";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
import Clipboard from "clipboard";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "cl-upload-space-item",
|
name: "cl-upload-space-item",
|
||||||
@ -94,6 +96,26 @@ export default defineComponent({
|
|||||||
function openContextMenu(e: any) {
|
function openContextMenu(e: any) {
|
||||||
ContextMenu.open(e, {
|
ContextMenu.open(e, {
|
||||||
list: [
|
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 ? "取消选中" : "选中",
|
label: isSelected.value ? "取消选中" : "选中",
|
||||||
"suffix-icon": isSelected.value ? "el-icon-close" : "el-icon-check",
|
"suffix-icon": isSelected.value ? "el-icon-close" : "el-icon-check",
|
||||||
|
|||||||
@ -930,10 +930,10 @@ change-case@^4.1.2:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents "~2.3.1"
|
fsevents "~2.3.1"
|
||||||
|
|
||||||
cl-admin-crud-vue3@^0.3.12:
|
cl-admin-crud-vue3@^0.3.14:
|
||||||
version "0.3.12"
|
version "0.3.14"
|
||||||
resolved "https://registry.nlark.com/cl-admin-crud-vue3/download/cl-admin-crud-vue3-0.3.12.tgz#afbbb52711f8f6e032dcacbd22977c9fa58d8662"
|
resolved "https://registry.nlark.com/cl-admin-crud-vue3/download/cl-admin-crud-vue3-0.3.14.tgz#b2463e60e5b999768a8b8e895436343c90c01e92"
|
||||||
integrity sha1-r7u1JxH49uAy3Ky9Ipd8n6WNhmI=
|
integrity sha1-skY+YOW5mXaKi46JVDY0PJDAHpI=
|
||||||
dependencies:
|
dependencies:
|
||||||
array.prototype.flat "^1.2.4"
|
array.prototype.flat "^1.2.4"
|
||||||
core-js "^3.6.5"
|
core-js "^3.6.5"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user