This commit is contained in:
2023-10-10 14:10:32 +08:00
parent e36d60d015
commit 2f788956c6
8 changed files with 1597 additions and 1509 deletions

View File

@@ -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>