i
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
:headers="config.headers"
|
||||
@success="success"
|
||||
@failure="failure"
|
||||
:multiple="false"
|
||||
:multiple="multiple"
|
||||
>
|
||||
</nut-uploader>
|
||||
</template>
|
||||
@@ -24,22 +24,26 @@ const props = defineProps({
|
||||
max: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
const emits = defineEmits(['update:list'])
|
||||
|
||||
const fileList = computed({
|
||||
get: () => props.list,
|
||||
set: (val) => emits('update:list', val)
|
||||
})
|
||||
});
|
||||
|
||||
const config = ref({
|
||||
url: `${BASE_URL}/upload`,
|
||||
headers: {
|
||||
token: Taro.getStorageSync('token')
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
|
||||
const success = (res: any) => {
|
||||
const data = JSON.parse(res.responseText.data)
|
||||
@@ -47,15 +51,15 @@ const success = (res: any) => {
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success'
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const failure = () => {
|
||||
Taro.showToast({
|
||||
title: '上传失败',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss"></style>
|
||||
|
||||
Reference in New Issue
Block a user