update
This commit is contained in:
17
src/hooks/useUploadLength.js
Normal file
17
src/hooks/useUploadLength.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import {watch} from "vue";
|
||||
import {Message} from "@arco-design/web-vue";
|
||||
|
||||
const useUploadLength = ({array, length}) => {
|
||||
watch(
|
||||
() => array,
|
||||
(val) => {
|
||||
if (val.length > length) {
|
||||
Message.warning(`最多可上传${length}个`);
|
||||
val.length = length;
|
||||
}
|
||||
},
|
||||
{deep: true,}
|
||||
)
|
||||
}
|
||||
|
||||
export default useUploadLength;
|
||||
Reference in New Issue
Block a user