Browse Source

fix(gui-v2): push the created view to router

pull/3078/head
Wing-Kam Wong 2 years ago
parent
commit
753a590998
  1. 5
      packages/nc-gui-v2/components/smartsheet/sidebar/index.vue

5
packages/nc-gui-v2/components/smartsheet/sidebar/index.vue

@ -3,7 +3,7 @@ import type { FormType, GalleryType, GridType, KanbanType, ViewTypes } from 'noc
import MenuTop from './MenuTop.vue' import MenuTop from './MenuTop.vue'
import MenuBottom from './MenuBottom.vue' import MenuBottom from './MenuBottom.vue'
import Toolbar from './toolbar/index.vue' import Toolbar from './toolbar/index.vue'
import { computed, inject, provide, ref, useRoute, useViews, watch } from '#imports' import { computed, inject, provide, ref, useRoute, useRouter, useViews, watch } from '#imports'
import { ActiveViewInj, MetaInj, RightSidebarInj, ViewListInj } from '~/context' import { ActiveViewInj, MetaInj, RightSidebarInj, ViewListInj } from '~/context'
const meta = inject(MetaInj, ref()) const meta = inject(MetaInj, ref())
@ -12,6 +12,8 @@ const activeView = inject(ActiveViewInj, ref())
const { views, loadViews } = useViews(meta) const { views, loadViews } = useViews(meta)
const router = useRouter()
const route = useRoute() const route = useRoute()
provide(ViewListInj, views) provide(ViewListInj, views)
@ -59,6 +61,7 @@ function openModal({ type, title = '' }: { type: ViewTypes; title: string }) {
function onCreate(view: GridType | FormType | KanbanType | GalleryType) { function onCreate(view: GridType | FormType | KanbanType | GalleryType) {
views.value.push(view) views.value.push(view)
activeView.value = view activeView.value = view
router.push({ params: { viewTitle: view.title || '' } })
modalOpen = false modalOpen = false
} }
</script> </script>

Loading…
Cancel
Save