Commit be856d06 authored by 潘永坪's avatar 潘永坪

图片大小限制

parent c8260ae2
......@@ -172,6 +172,13 @@ export default{
async afterRead(event) {
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
if(event.file[0].size>1024*1024*10){
uni.showToast({
title:'图片内存不能大于10M',
icon: 'none'
})
return
}
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
......
......@@ -72,6 +72,13 @@ export default{
async afterRead(event) {
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
if(event.file[0].size>1024*1024*10){
uni.showToast({
title:'图片内存不能大于10M',
icon: 'none'
})
return
}
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment