Skip to content

Commit

Permalink
fix: 修复naive 最后一个文件无法删除的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed Sep 16, 2023
1 parent fa18d93 commit 49c0e6f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
5 changes: 3 additions & 2 deletions docs/zh/guide/advance/dict.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ const crudOptions = {

#### 单例模式
* dict.cloneable=false
此模式下,全局只有一个dict实例,初始化复制时仅仅只是复制同一个实例的引用。
所以你可以保留这个dict实例的引用,修改这个实例的data,会影响页面内的所有使用这个dict的组件的显示
* 此模式下,整个页面内只有一个dict实例,初始化复制时仅仅只是复制同一个实例的引用。
* 所以你可以保留这个dict实例的引用,修改这个实例的data,会影响页面内的所有使用这个dict的组件的显示
* 你还可以将dict的实例放到一个全局文件中,在其他页面中引用,单例dict就是一个store。

#### 分发复制模式
* dict.cloneable=true
Expand Down
17 changes: 12 additions & 5 deletions packages/fast-extends/src/uploader/components/fs-file-uploader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ export default defineComponent({
}
async function emitValue(list: FileItem[]) {
let value = await buildEmitValue(list);
console.log("update value:", value);
debugger;
onInput(value);
nextTick(async () => {
await onFormValueChanged();
Expand Down Expand Up @@ -281,6 +283,7 @@ export default defineComponent({
}
);
//@ts-ignore
// eslint-disable-next-line vue/no-setup-props-destructure
initFileList(props.modelValue);
function hasUploading() {
const uploading = fileList.value.filter((item: any) => {
Expand Down Expand Up @@ -550,12 +553,16 @@ export default defineComponent({
checkLimit();
ctx.emit("exceed", { fileList: fileList.value });
},
onRemove: (file: any) => {
handleChange(file, fileList.value);
onRemove: (opts: any) => {
const { file, fileList } = opts;
console.log("onremove:", opts);
// handleChange(file, [...fileList]);
},
onChange: ({ event, file, fileList }: any) => {
fileList = appendExtra(fileList);
handleChange(file, fileList);
onChange: (opts: any) => {
const { event, file, fileList } = opts;
console.log("onChange:", opts);
const list = appendExtra(fileList);
handleChange(file, [...list]);
},
onFinish: (file: any) => {
const extra = naiveExtraCache[file.id];
Expand Down

0 comments on commit 49c0e6f

Please sign in to comment.