mirror of
https://github.com/yangzongzhuan/RuoYi-Vue3.git
synced 2025-09-27 14:52:40 +00:00
图片上传组件新增disabled属性
This commit is contained in:
@@ -214,7 +214,7 @@ function listToString(list, separator) {
|
|||||||
|
|
||||||
// 初始化拖拽排序
|
// 初始化拖拽排序
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.drag) {
|
if (props.drag && !props.disabled) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const element = proxy.$refs.uploadFileList?.$el || proxy.$refs.uploadFileList
|
const element = proxy.$refs.uploadFileList?.$el || proxy.$refs.uploadFileList
|
||||||
Sortable.create(element, {
|
Sortable.create(element, {
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
<div class="component-upload-image">
|
<div class="component-upload-image">
|
||||||
<el-upload
|
<el-upload
|
||||||
multiple
|
multiple
|
||||||
|
:disabled="disabled"
|
||||||
:action="uploadImgUrl"
|
:action="uploadImgUrl"
|
||||||
list-type="picture-card"
|
list-type="picture-card"
|
||||||
:on-success="handleUploadSuccess"
|
:on-success="handleUploadSuccess"
|
||||||
@@ -21,7 +22,7 @@
|
|||||||
<el-icon class="avatar-uploader-icon"><plus /></el-icon>
|
<el-icon class="avatar-uploader-icon"><plus /></el-icon>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<!-- 上传提示 -->
|
<!-- 上传提示 -->
|
||||||
<div class="el-upload__tip" v-if="showTip">
|
<div class="el-upload__tip" v-if="showTip && !disabled">
|
||||||
请上传
|
请上传
|
||||||
<template v-if="fileSize">
|
<template v-if="fileSize">
|
||||||
大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b>
|
大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b>
|
||||||
@@ -82,6 +83,11 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
|
// 禁用组件(仅查看图片)
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
// 拖动排序
|
// 拖动排序
|
||||||
drag: {
|
drag: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -225,7 +231,7 @@ function listToString(list, separator) {
|
|||||||
|
|
||||||
// 初始化拖拽排序
|
// 初始化拖拽排序
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.drag) {
|
if (props.drag && !props.disabled) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const element = proxy.$refs.imageUpload?.$el?.querySelector('.el-upload-list')
|
const element = proxy.$refs.imageUpload?.$el?.querySelector('.el-upload-list')
|
||||||
Sortable.create(element, {
|
Sortable.create(element, {
|
||||||
@@ -245,4 +251,8 @@ onMounted(() => {
|
|||||||
:deep(.hide .el-upload--picture-card) {
|
:deep(.hide .el-upload--picture-card) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.el-upload.el-upload--picture-card.is-disabled) {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
Reference in New Issue
Block a user