티스토리 뷰
electron
에서 vue-router
를 사용할때 동작을 하지 않는 경우가 있다.
router
를 생성할때 history
모드가 아닌 hash
모드를 사용하면 잘 동작 한다.
※ 아래의 코드는 vue 3.x
와 vue-router 4.x
의 예제 코드 이다.
// router.ts
import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [
{ path: '/page1', component: () => import('./Page1.vue') },
{ path: '/page2', component: () => import('./Page2.vue') }
]
export default createRouter({
history: createWebHashHistory(),
routes
})
// main.ts
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
const app = createApp(App)
app.use(router)
app.mount('#app')
'프로그래밍 > Node.js' 카테고리의 다른 글
[Electron] better-sqlite3 NODE_MODULE_VERSION 문제 (0) | 2022.07.28 |
---|---|
Electron + Vite + Vue3 + Typescript 을 이용한 데스크탑 앱 개발 환경 (0) | 2022.01.06 |
[svelte] 시작하기 (with typescript) (0) | 2022.01.06 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday