We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用electron-vite创建了项目,在工程中添加vue-router路由,无论是electron子窗口或者浏览器中打开我定义的路由的地址,都是App.vue中的内容
package.json
{ "name": "electron-vite-quickstart", "version": "1.0.0", "description": "An Electron application with Vue and TypeScript", "main": "./out/main/index.js", "author": "example.com", "homepage": "https://electron-vite.org", "scripts": { "format": "prettier --write .", "lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.vue --fix", "typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false", "typecheck:web": "vue-tsc --noEmit -p tsconfig.web.json --composite false", "typecheck": "npm run typecheck:node && npm run typecheck:web", "start": "electron-vite preview", "dev": "electron-vite dev", "build": "npm run typecheck && electron-vite build", "postinstall": "electron-builder install-app-deps", "build:unpack": "npm run build && electron-builder --dir", "build:win": "npm run build && electron-builder --win", "build:mac": "npm run build && electron-builder --mac", "build:linux": "npm run build && electron-builder --linux" }, "dependencies": { "@electron-toolkit/preload": "^3.0.0", "@electron-toolkit/utils": "^3.0.0", "vue-router": "^4.4.5" }, "devDependencies": { "@electron-toolkit/eslint-config": "^1.0.2", "@electron-toolkit/eslint-config-ts": "^2.0.0", "@electron-toolkit/tsconfig": "^1.0.1", "@rushstack/eslint-patch": "^1.10.3", "@types/node": "^20.14.8", "@vitejs/plugin-vue": "^5.0.5", "@vue/eslint-config-prettier": "^9.0.0", "@vue/eslint-config-typescript": "^13.0.0", "electron": "^31.0.2", "electron-builder": "^24.13.3", "electron-vite": "^2.3.0", "eslint": "^8.57.0", "eslint-plugin-vue": "^9.26.0", "prettier": "^3.3.2", "typescript": "^5.5.2", "vite": "^5.3.1", "vue": "^3.4.30", "vue-tsc": "^2.0.22" } }
electron.vite.config.ts
`import { resolve } from 'path' import { defineConfig, externalizeDepsPlugin } from 'electron-vite' import vue from '@vitejs/plugin-vue'
export default defineConfig({ main: { plugins: [externalizeDepsPlugin()] }, preload: { plugins: [externalizeDepsPlugin()] }, renderer: { resolve: { alias: { '@Renderer': resolve('src/renderer/src') } }, plugins: [vue()] } }) `
/src/renderer/src/main.ts
/src/renderer/src/route/index.ts
/src/renderer/src/components/Countdown.vue
主进程index.ts
实际效果
2.3.0
31.0.2
5.3.1
The text was updated successfully, but these errors were encountered:
https://cn.electron-vite.org/guide/troubleshooting#vue-router-%E6%88%96-react-router-dom-%E5%BC%80%E5%8F%91%E6%A8%A1%E5%BC%8F%E6%AD%A3%E5%B8%B8-%E4%BD%86%E5%9C%A8%E6%9E%84%E5%BB%BA%E5%90%8E%E6%97%A0%E6%95%88
Sorry, something went wrong.
嗯。。。 我确认已经使用的是createWebHashHistory 方法
没有仔细阅读,加载方式错误
是这样使用的吗
No branches or pull requests
Describe the bug
使用electron-vite创建了项目,在工程中添加vue-router路由,无论是electron子窗口或者浏览器中打开我定义的路由的地址,都是App.vue中的内容
package.json
{ "name": "electron-vite-quickstart", "version": "1.0.0", "description": "An Electron application with Vue and TypeScript", "main": "./out/main/index.js", "author": "example.com", "homepage": "https://electron-vite.org", "scripts": { "format": "prettier --write .", "lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.vue --fix", "typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false", "typecheck:web": "vue-tsc --noEmit -p tsconfig.web.json --composite false", "typecheck": "npm run typecheck:node && npm run typecheck:web", "start": "electron-vite preview", "dev": "electron-vite dev", "build": "npm run typecheck && electron-vite build", "postinstall": "electron-builder install-app-deps", "build:unpack": "npm run build && electron-builder --dir", "build:win": "npm run build && electron-builder --win", "build:mac": "npm run build && electron-builder --mac", "build:linux": "npm run build && electron-builder --linux" }, "dependencies": { "@electron-toolkit/preload": "^3.0.0", "@electron-toolkit/utils": "^3.0.0", "vue-router": "^4.4.5" }, "devDependencies": { "@electron-toolkit/eslint-config": "^1.0.2", "@electron-toolkit/eslint-config-ts": "^2.0.0", "@electron-toolkit/tsconfig": "^1.0.1", "@rushstack/eslint-patch": "^1.10.3", "@types/node": "^20.14.8", "@vitejs/plugin-vue": "^5.0.5", "@vue/eslint-config-prettier": "^9.0.0", "@vue/eslint-config-typescript": "^13.0.0", "electron": "^31.0.2", "electron-builder": "^24.13.3", "electron-vite": "^2.3.0", "eslint": "^8.57.0", "eslint-plugin-vue": "^9.26.0", "prettier": "^3.3.2", "typescript": "^5.5.2", "vite": "^5.3.1", "vue": "^3.4.30", "vue-tsc": "^2.0.22" } }
electron.vite.config.ts
`import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
main: {
plugins: [externalizeDepsPlugin()]
},
preload: {
plugins: [externalizeDepsPlugin()]
},
renderer: {
resolve: {
alias: {
'@Renderer': resolve('src/renderer/src')
}
},
plugins: [vue()]
}
})
`
/src/renderer/src/main.ts
/src/renderer/src/route/index.ts
/src/renderer/src/components/Countdown.vue
主进程index.ts
实际效果
Electron-Vite Version
2.3.0
Electron Version
31.0.2
Vite Version
5.3.1
Validations
The text was updated successfully, but these errors were encountered: