8355-testToMaster #1177
|
@ -38,6 +38,10 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
keepData: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
const sectionValue = computed(() => $props.section ?? $props.dataKey);
|
||||
|
@ -46,6 +50,7 @@ onBeforeMount(() => {
|
|||
if ($props.dataKey)
|
||||
arrayData = useArrayData($props.dataKey, {
|
||||
searchUrl: 'table',
|
||||
keepData: $props.keepData,
|
||||
...$props.arrayDataProps,
|
||||
navigate: $props.redirect,
|
||||
});
|
||||
|
|
|
@ -111,14 +111,9 @@ onMounted(async () => {
|
|||
mounted.value = true;
|
||||
});
|
||||
|
||||
// onBeforeRouteUpdate((to, from, next) => {
|
||||
// if (to.name === from.name && to.path !== from.path) {
|
||||
// arrayData.reset(['data']);
|
||||
// }
|
||||
// next();
|
||||
// });
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
console.log('store.keepData: ', store.keepData);
|
||||
if (!store.keepData) arrayData.reset(['data']);
|
||||
arrayData.resetPagination();
|
||||
});
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
'searchUrl',
|
||||
'navigate',
|
||||
'mapKey',
|
||||
'keepData',
|
||||
];
|
||||
if (typeof userOptions === 'object') {
|
||||
for (const option in userOptions) {
|
||||
|
|
|
@ -18,6 +18,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
|
|||
navigate: null,
|
||||
page: 1,
|
||||
mapKey: 'id',
|
||||
keepData: false,
|
||||
};
|
||||
|
||||
function get(key) {
|
||||
|
|
Loading…
Reference in New Issue