vue-vben-admin icon indicating copy to clipboard operation
vue-vben-admin copied to clipboard

项目开启页面缓存,但是相同页面的同组件内容会被覆盖

Open AidenYan97 opened this issue 1 year ago • 4 comments

已有数据页面的Upload组件,已有文件数量为1 image 打开相同页面,但Upload组件已有文件数量为0 image 此时再切换回Uploa组件有数据的页面。Upload组件变为最近打开时组件的状态 image

也没有在文档上找到如何设置组件的key来区分组件缓存

AidenYan97 avatar Nov 07 '23 02:11 AidenYan97

看不明白你想表达什么,录制个视频吧

wangjue666 avatar Nov 07 '23 03:11 wangjue666

看不明白你想表达什么,录制个视频吧

就是a页面有上传组件,b页面也有上传组件, 但是b组件的上传组件加载数据后,有个文件B1, 我再切回a页面,a页面的上传组件内容就变成B1了。

AidenYan97 avatar Nov 07 '23 05:11 AidenYan97

看不明白你想表达什么,录制个视频吧

就是a页面有上传组件,b页面也有上传组件, 但是b组件的上传组件加载数据后,有个文件B1, 我再切回a页面,a页面的上传组件内容就变成B1了。

你的组件是用

DesignHhuang avatar Nov 07 '23 09:11 DesignHhuang

看不明白你想表达什么,录制个视频吧

就是a页面有上传组件,b页面也有上传组件, 但是b组件的上传组件加载数据后,有个文件B1, 我再切回a页面,a页面的上传组件内容就变成B1了。

你的组件是用

嗯,使用的不是

<template>
  <BasicForm @register="register" />
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { BasicForm, useForm } from '/@/components/Form/index';
import { FormSchema } from '/@/components/Form/index';

export default defineComponent({
  name: 'InvoiceInWorkFlow',
  components: {
    BasicForm,
  },
  setup() {
    const invoiceInFormSchemas: FormSchema[] = [
      {
        field: 'PurchasingUnit',
        component: 'Input',
        label: '购货单位',
        required: true,
        itemProps: {
          labelCol: { class: 'label_w_xs' },
        },
        componentProps: {
          placeholder: '购货单位',
        },
        slot: 'PurchasingUnit',
      },
      {
        field: 'File',
        label: '附件',
        colProps: {
          lg: 24,
        },
        itemProps: {
          labelCol: { class: 'label_w_xs' },
        },
        component: 'Upload',
        componentProps: {
          maxSize: 10,
          api: '/api/upload',
        },
      },
    ];
    const [register, { validate, setFieldsValue: setValues, getFieldsValue, updateSchema }] = useForm({
      compact: true,
      baseColProps: {
        lg: 12,
        sm: 24,
      },
      schemas: invoiceInFormSchemas,
      showActionButtonGroup: false,
    });

    return {
      register,
    };
  },
});
</script>

他把Upload上传组件又套在了BasicForm组件里面,所以我想问问能不能给这个Upload上传组件单独声明一个唯一的key,这样打开相同得页面每个上传控件就不重复了。

AidenYan97 avatar Nov 09 '23 05:11 AidenYan97

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

anncwb avatar Apr 09 '24 01:04 anncwb