Skip to content
\n
// ./src/Components/UnitsTable.vue\n\n<script setup lang=\"ts\">\nimport Panel from '@/components/Common/Panel.vue'\nimport { computed } from 'vue'\n\nimport { useRepo } from 'pinia-orm'\nimport { UnitEntity } from '@/stores/units'\n\nconst unitsRepo = computed(() => {\n  return useRepo(UnitEntity)\n})\n</script>\n<template>\n  <Panel>\n    <template v-slot:body>\n      <div class=\"row g-0\">\n        <table class=\"table table-sm table-hover\">\n          <thead>\n            <tr>\n              <th scope=\"col\">Unit</th>\n              <th scope=\"col\">Type</th>\n              <th scope=\"col\">Status</th>\n              <th scope=\"col\">Location</th>\n              <th scope=\"col\">Assigned Event</th>\n            </tr>\n          </thead>\n          <tbody>\n            <tr v-for=\"unit in unitsRepo.withAll().get()\" :key=\"unit.id\">\n              <th scope=\"row\">{{ unit.callsign }}</th>\n              <td>{{ unit.unitType }}</td>\n              <td>{{ unit.status }}</td>\n              <td>{{ unit.location }}</td>\n              <td>{{ unit.assignedEvent?.id }}</td>\n            </tr>\n          </tbody>\n        </table>\n      </div>\n    </template>\n  </Panel>\n</template>\n@/stores/units\n
\n
// ./src/main.ts\n\n\nimport { createApp } from 'vue'\nimport router from './router'\n\nimport '@/main.scss'\nimport 'dockview-vue/dist/styles/dockview.css'\n\nimport DockView from './DockView.vue'\n\nconst app = createApp(DockView)\n\napp.mount('#app')\n
","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"

Ah! Figured it out! Meta AI suggested this:
\napp.component('UnitsTable', UnitsTable) in main.ts

\n

Here's the full main.ts file:

\n
import { createApp } from 'vue'\nimport { createPinia } from 'pinia'\nimport { createORM } from 'pinia-orm'\n\nimport { PiniaSharedState } from 'pinia-shared-state'\n\nimport App from './App.vue'\nimport router from './router'\n\nimport '@/main.scss'\nimport 'fundamental-styles/dist/theming/sap_horizon_dark.css'\nimport '@sap-theming/theming-base-content/content/Base/baseLib/sap_horizon_dark/css_variables.css'\nimport 'dockview-vue/dist/styles/dockview.css'\n\nimport urql, { cacheExchange, fetchExchange } from '@urql/vue'\n\nimport DockView from './DockView.vue'\nimport UnitsTable from './components/UnitsTable.vue'\n\nconst app = createApp(DockView)\n\napp.use(\n  createPinia()\n    .use(createORM())\n    .use(PiniaSharedState({ enable: true }))\n)\napp.use(router)\n\napp.use(urql, {\n  url: 'http://localhost:5107/graphql',\n  exchanges: [cacheExchange, fetchExchange]\n})\n\napp.component('UnitsTable', UnitsTable)\n\napp.mount('#app')\n
","upvoteCount":1,"url":"https://github.com/mathuo/dockview/discussions/757#discussioncomment-11149055"}}}

How do I register vue single file components with dockview so that I can register them as dockview panels? #757

Answered by memtech3
memtech3 asked this question in Q&A
Discussion options

You must be logged in to vote

Ah! Figured it out! Meta AI suggested this:
app.component('UnitsTable', UnitsTable) in main.ts

Here's the full main.ts file:

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { createORM } from 'pinia-orm'

import { PiniaSharedState } from 'pinia-shared-state'

import App from './App.vue'
import router from './router'

import '@/main.scss'
import 'fundamental-styles/dist/theming/sap_horizon_dark.css'
import '@sap-theming/theming-base-content/content/Base/baseLib/sap_horizon_dark/css_variables.css'
import 'dockview-vue/dist/styles/dockview.css'

import urql, { cacheExchange, fetchExchange } from '@urql/vue'

import DockView from './DockView.vue'
import UnitsTable f…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by memtech3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant