refactor: simplify page models and view driver usage
Move simple page models into page components and build trivial computed models directly in views to avoid unnecessary page drivers. Update views to destructure page driver returns and rely on template ref unwrapping, and document the guidance for when page drivers should be introduced.refactor: simplify page models and view driver usage Move simple page models into page components and build trivial computed models directly in views to avoid unnecessary page drivers. Update views to destructure page driver returns and rely on template ref unwrapping, and document the guidance for when page drivers should be introduced.
This commit is contained in:
@@ -2,15 +2,14 @@
|
||||
import PageSectionQueryPageDemo from '@/components/pages/PageSectionQueryPageDemo.vue'
|
||||
import { useSectionsDemoPage } from '@/composables/page-drivers/useSectionsDemoPage'
|
||||
|
||||
// Demo view 維持薄層,只掛 page driver,並把 page model / actions 傳給 page component。
|
||||
const page = useSectionsDemoPage()
|
||||
const { handleQueryBack, handleQuerySearch, pageModel, queryFilters } = useSectionsDemoPage()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PageSectionQueryPageDemo
|
||||
v-model:query-filters="page.queryFilters.value"
|
||||
:page="page.pageModel.value"
|
||||
@back="page.handleQueryBack"
|
||||
@search="page.handleQuerySearch"
|
||||
v-model:query-filters="queryFilters"
|
||||
:page="pageModel"
|
||||
@back="handleQueryBack"
|
||||
@search="handleQuerySearch"
|
||||
/>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user