@huberyyang/create-todo-vue 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/template-vue-dev/.husky/commit-msg +1 -0
- package/template-vue-dev/.husky/pre-commit +1 -0
- package/template-vue-dev/.vscode/extensions.json +3 -0
- package/template-vue-dev/.vscode/settings.json +50 -0
- package/template-vue-dev/README.md +1 -0
- package/template-vue-dev/_gitignore +24 -0
- package/template-vue-dev/auto-imports.d.ts +619 -0
- package/template-vue-dev/commitlint.config.ts +18 -0
- package/template-vue-dev/components.d.ts +24 -0
- package/template-vue-dev/eslint.config.ts +48 -0
- package/template-vue-dev/index.html +24 -0
- package/template-vue-dev/lint-staged.config.mjs +3 -0
- package/template-vue-dev/package.json +52 -0
- package/template-vue-dev/pnpm-workspace.yaml +5 -0
- package/template-vue-dev/public/vite.svg +1 -0
- package/template-vue-dev/shims.d.ts +6 -0
- package/template-vue-dev/src/App.vue +16 -0
- package/template-vue-dev/src/assets/vue.svg +1 -0
- package/template-vue-dev/src/components/BaseFooter.vue +8 -0
- package/template-vue-dev/src/composables/useDark.ts +2 -0
- package/template-vue-dev/src/main.ts +15 -0
- package/template-vue-dev/src/pages/[...all].vue +5 -0
- package/template-vue-dev/src/pages/article/[id].vue +13 -0
- package/template-vue-dev/src/pages/index.vue +85 -0
- package/template-vue-dev/src/pages/test.vue +17 -0
- package/template-vue-dev/src/styles/main.scss +6 -0
- package/template-vue-dev/src/styles/variables.scss +7 -0
- package/template-vue-dev/src/types/index.d.ts +1 -0
- package/template-vue-dev/src/types/vite-env.d.ts +2 -0
- package/template-vue-dev/tsconfig.json +27 -0
- package/template-vue-dev/typed-router.d.ts +121 -0
- package/template-vue-dev/uno.config.ts +29 -0
- package/template-vue-dev/vite.config.ts +85 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
extends: ['@commitlint/config-conventional'],
|
|
3
|
+
rules: {
|
|
4
|
+
'type-enum': [2, 'always', [
|
|
5
|
+
'feat',
|
|
6
|
+
'fix',
|
|
7
|
+
'docs',
|
|
8
|
+
'style',
|
|
9
|
+
'refactor',
|
|
10
|
+
'perf',
|
|
11
|
+
'test',
|
|
12
|
+
'build',
|
|
13
|
+
'ci',
|
|
14
|
+
'revert',
|
|
15
|
+
'chore',
|
|
16
|
+
]],
|
|
17
|
+
},
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
// biome-ignore lint: disable
|
|
4
|
+
// oxlint-disable
|
|
5
|
+
// ------
|
|
6
|
+
// Generated by unplugin-vue-components
|
|
7
|
+
// Read more: https://github.com/vuejs/core/pull/3399
|
|
8
|
+
|
|
9
|
+
export {}
|
|
10
|
+
|
|
11
|
+
/* prettier-ignore */
|
|
12
|
+
declare module 'vue' {
|
|
13
|
+
export interface GlobalComponents {
|
|
14
|
+
BaseFooter: typeof import('./src/components/BaseFooter.vue')['default']
|
|
15
|
+
ElButton: typeof import('element-plus/es')['ElButton']
|
|
16
|
+
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
|
|
17
|
+
ElIcon: typeof import('element-plus/es')['ElIcon']
|
|
18
|
+
ElSpace: typeof import('element-plus/es')['ElSpace']
|
|
19
|
+
IEpSearch: typeof import('~icons/ep/search')['default']
|
|
20
|
+
IEpShare: typeof import('~icons/ep/share')['default']
|
|
21
|
+
RouterLink: typeof import('vue-router')['RouterLink']
|
|
22
|
+
RouterView: typeof import('vue-router')['RouterView']
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import antfu from '@antfu/eslint-config'
|
|
2
|
+
|
|
3
|
+
export default antfu(
|
|
4
|
+
{
|
|
5
|
+
type: 'app',
|
|
6
|
+
vue: true,
|
|
7
|
+
typescript: true,
|
|
8
|
+
unocss: true,
|
|
9
|
+
markdown: false,
|
|
10
|
+
formatters: {
|
|
11
|
+
css: true,
|
|
12
|
+
html: true,
|
|
13
|
+
},
|
|
14
|
+
rules: {
|
|
15
|
+
'no-console': 'off',
|
|
16
|
+
},
|
|
17
|
+
ignores: ['**/public/**'],
|
|
18
|
+
},
|
|
19
|
+
// vue规则定制
|
|
20
|
+
{
|
|
21
|
+
files: ['**/*.vue'],
|
|
22
|
+
rules: {
|
|
23
|
+
// 限制属性数量换行
|
|
24
|
+
'vue/max-attributes-per-line': ['error', {
|
|
25
|
+
singleline: { max: 6 },
|
|
26
|
+
multiline: { max: 1 },
|
|
27
|
+
}],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
// ts规则定制
|
|
31
|
+
{
|
|
32
|
+
files: ['**/*.ts', '**/*.tsx', '**/*.vue'],
|
|
33
|
+
rules: {
|
|
34
|
+
// 允许any
|
|
35
|
+
'ts/no-explicit-any': 'off',
|
|
36
|
+
// 强制使用import type导入类型
|
|
37
|
+
'ts/consistent-type-imports': ['error', {
|
|
38
|
+
prefer: 'type-imports',
|
|
39
|
+
fixStyle: 'inline-type-imports',
|
|
40
|
+
}],
|
|
41
|
+
// 禁止未使用的变量,但允许使用下划线忽略
|
|
42
|
+
'ts/no-unused-vars': ['warn', {
|
|
43
|
+
argsIgnorePattern: '^_',
|
|
44
|
+
varsIgnorePattern: '^_',
|
|
45
|
+
}],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>A `quick-start` Vue3 Template</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<noscript>
|
|
12
|
+
<div>Please enable JavaScript to use this application.</div>
|
|
13
|
+
</noscript>
|
|
14
|
+
<script>
|
|
15
|
+
;(function () {
|
|
16
|
+
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
17
|
+
const setting = localStorage.getItem('color-schema') || 'auto'
|
|
18
|
+
if (setting === 'dark' || (prefersDark && setting !== 'light'))
|
|
19
|
+
document.documentElement.classList.toggle('dark', true)
|
|
20
|
+
})()
|
|
21
|
+
</script>
|
|
22
|
+
<script type="module" src="/src/main.ts"></script>
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vue-dev",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite --open",
|
|
8
|
+
"build": "vue-tsc --noEmit && vite build",
|
|
9
|
+
"tscheck": "vue-tsc --noEmit",
|
|
10
|
+
"preview": "vite preview",
|
|
11
|
+
"lint": "eslint",
|
|
12
|
+
"lint:fix": "eslint --fix",
|
|
13
|
+
"taze": "npx taze major -r",
|
|
14
|
+
"prepare": "husky",
|
|
15
|
+
"commitlint": "commitlint --edit"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@element-plus/icons-vue": "^2.3.2",
|
|
19
|
+
"@vueuse/core": "^14.4.0",
|
|
20
|
+
"prismjs": "^1.30.0",
|
|
21
|
+
"sass": "^1.103.1",
|
|
22
|
+
"vite-svg-loader": "^5.1.1",
|
|
23
|
+
"vue": "^3.5.41",
|
|
24
|
+
"vue-router": "^5.2.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@antfu/eslint-config": "^9.3.0",
|
|
28
|
+
"@commitlint/cli": "^21.2.2",
|
|
29
|
+
"@commitlint/config-conventional": "^21.2.2",
|
|
30
|
+
"@huberyyang/todo-scripts": "^1.1.1",
|
|
31
|
+
"@iconify-json/carbon": "^1.2.25",
|
|
32
|
+
"@iconify-json/ep": "^1.2.4",
|
|
33
|
+
"@types/node": "^26.3.0",
|
|
34
|
+
"@types/prismjs": "^1.26.6",
|
|
35
|
+
"@unocss/eslint-plugin": "^66.8.1",
|
|
36
|
+
"@unocss/reset": "^66.8.1",
|
|
37
|
+
"@vitejs/plugin-vue": "^6.0.8",
|
|
38
|
+
"element-plus": "^2.14.5",
|
|
39
|
+
"eslint": "^10.9.1",
|
|
40
|
+
"eslint-plugin-format": "^2.0.1",
|
|
41
|
+
"husky": "^9.1.7",
|
|
42
|
+
"lint-staged": "^17.3.0",
|
|
43
|
+
"typescript": "^6.0.3",
|
|
44
|
+
"unocss": "^66.8.1",
|
|
45
|
+
"unplugin-auto-import": "^21.1.0",
|
|
46
|
+
"unplugin-icons": "^23.0.1",
|
|
47
|
+
"unplugin-vue-components": "^32.1.0",
|
|
48
|
+
"vite": "^8.2.2",
|
|
49
|
+
"vite-plugin-vue-devtools": "^8.2.1",
|
|
50
|
+
"vue-tsc": "^3.3.11"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<el-config-provider :locale="zhCn">
|
|
7
|
+
<main p="x-4 y-10" text="center gray-700 dark:gray-200" h-100vh w-100vw font-sans>
|
|
8
|
+
<router-view v-slot="{ Component }">
|
|
9
|
+
<keep-alive :include="[]">
|
|
10
|
+
<component :is="Component" />
|
|
11
|
+
</keep-alive>
|
|
12
|
+
</router-view>
|
|
13
|
+
<BaseFooter />
|
|
14
|
+
</main>
|
|
15
|
+
</el-config-provider>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div flex="~ justify-center items-center" fixed bottom-0 mb-10 w-full gap-2 text-2xl>
|
|
3
|
+
<button icon-btn @click="toggleDark()">
|
|
4
|
+
<div i-carbon-sun dark:i-carbon-moon />
|
|
5
|
+
</button>
|
|
6
|
+
<a icon-btn i-carbon:logo-github href="https://github.com/Hub-yang/my-vue-dev-template" title="GitHub" target="_blank" />
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createApp } from 'vue'
|
|
2
|
+
import { createRouter, createWebHistory } from 'vue-router'
|
|
3
|
+
import { routes } from 'vue-router/auto-routes'
|
|
4
|
+
import App from './App.vue'
|
|
5
|
+
import './styles/main.scss'
|
|
6
|
+
import 'uno.css'
|
|
7
|
+
import '@unocss/reset/tailwind.css'
|
|
8
|
+
|
|
9
|
+
export const router = createRouter({
|
|
10
|
+
history: createWebHistory(),
|
|
11
|
+
routes,
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const app = createApp(App)
|
|
15
|
+
app.use(router).mount('#app')
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const router = useRouter()
|
|
3
|
+
const params = useRoute('/article/[id]').params
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<template>
|
|
7
|
+
<div mb-2 text-5 font-bold>
|
|
8
|
+
Article {{ params?.id ?? '' }}
|
|
9
|
+
</div>
|
|
10
|
+
<div btn @click="router.back()">
|
|
11
|
+
go back
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Prism from 'prismjs'
|
|
3
|
+
import 'prismjs/components/prism-javascript.min.js'
|
|
4
|
+
import 'prismjs/themes/prism-okaidia.css'
|
|
5
|
+
|
|
6
|
+
const router = useRouter()
|
|
7
|
+
const id = ref(0)
|
|
8
|
+
|
|
9
|
+
function goToArticle() {
|
|
10
|
+
router.push(`/article/${id.value}`)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const useUnocss = ref(true)
|
|
14
|
+
const cssMode = computed(() => useUnocss.value ? 'unocss' : 'scss')
|
|
15
|
+
|
|
16
|
+
watch(useUnocss, () => nextTick(() => Prism.highlightAll()), { immediate: true })
|
|
17
|
+
|
|
18
|
+
const code = computed(() => {
|
|
19
|
+
if (useUnocss.value) {
|
|
20
|
+
return `
|
|
21
|
+
<div v-if="useUnocss" overflow-hidden text-ellipsis text-nowrap>
|
|
22
|
+
Lorem ipsum dolor...
|
|
23
|
+
</div>
|
|
24
|
+
`
|
|
25
|
+
}
|
|
26
|
+
return `
|
|
27
|
+
@mixin text-overflow-ellipsis {
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
text-overflow: ellipsis;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
<style scoped lang="scss">
|
|
34
|
+
.text-overflow {
|
|
35
|
+
@include text-overflow-ellipsis();
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
38
|
+
`
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
function toggleCssMode() {
|
|
42
|
+
useUnocss.value = !useUnocss.value
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<div w-full flex="~ col items-center">
|
|
48
|
+
<div flex="~ justify-center items-center" gap-2>
|
|
49
|
+
<button btn @click="id--">
|
|
50
|
+
-
|
|
51
|
+
</button>
|
|
52
|
+
<a
|
|
53
|
+
class="cursor-pointer font-bold underline underline-offset-3 decoration-dashed transition-duration-250 transition-property-color hover:color-#646cff"
|
|
54
|
+
@click="goToArticle"
|
|
55
|
+
>
|
|
56
|
+
Go To Article {{ id }}
|
|
57
|
+
</a>
|
|
58
|
+
<button btn @click="id++">
|
|
59
|
+
+
|
|
60
|
+
</button>
|
|
61
|
+
</div>
|
|
62
|
+
<div mt-10 h-fit w="50%">
|
|
63
|
+
<button btn w-26 @click="toggleCssMode">
|
|
64
|
+
use {{ cssMode }}
|
|
65
|
+
</button>
|
|
66
|
+
<div bg="#272822" mt-3 rounded-1 p-2 color-white>
|
|
67
|
+
<div v-if="useUnocss" overflow-hidden text-ellipsis text-nowrap>
|
|
68
|
+
这一行文本刻意写得比容器宽,用来演示单行省略号——上面的按钮可以在 UnoCSS 原子类与 SCSS mixin 两种实现之间切换,效果是一样的。
|
|
69
|
+
</div>
|
|
70
|
+
<div v-else class="text-overflow">
|
|
71
|
+
这一行文本刻意写得比容器宽,用来演示单行省略号——上面的按钮可以在 UnoCSS 原子类与 SCSS mixin 两种实现之间切换,效果是一样的。
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
<div>
|
|
75
|
+
<pre><code class="language-javascript">{{ code }}</code></pre>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<style scoped lang="scss">
|
|
82
|
+
.text-overflow {
|
|
83
|
+
@include text-overflow-ellipsis();
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Edit } from '@element-plus/icons-vue'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<div>
|
|
7
|
+
<el-space wrap>
|
|
8
|
+
<span i-ep-edit text-xl />
|
|
9
|
+
<i-ep-share text-xl />
|
|
10
|
+
<IEpSearch text-xl />
|
|
11
|
+
<el-button type="primary" :icon="Edit">
|
|
12
|
+
Edit
|
|
13
|
+
</el-button>
|
|
14
|
+
<el-icon />
|
|
15
|
+
</el-space>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
type anyKey = Record<string, any>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"jsx": "preserve",
|
|
5
|
+
"lib": ["DOM", "ESNext"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"paths": {
|
|
9
|
+
"~/*": ["./src/*"]
|
|
10
|
+
},
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"types": [
|
|
13
|
+
"vite/client"
|
|
14
|
+
],
|
|
15
|
+
"allowJs": true,
|
|
16
|
+
"strict": true,
|
|
17
|
+
"strictNullChecks": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"esModuleInterop": true,
|
|
20
|
+
"forceConsistentCasingInFileNames": true,
|
|
21
|
+
"skipLibCheck": true
|
|
22
|
+
},
|
|
23
|
+
"include": [
|
|
24
|
+
"src/**/*",
|
|
25
|
+
"*.d.ts"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
// oxfmt-ignore
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
// noinspection ES6UnusedImports
|
|
6
|
+
// Generated by vue-router. !! DO NOT MODIFY THIS FILE !!
|
|
7
|
+
// It's recommended to commit this file.
|
|
8
|
+
// Make sure to add this file to your tsconfig.json file as an "includes" or "files" entry.
|
|
9
|
+
|
|
10
|
+
import type {
|
|
11
|
+
RouteRecordInfo,
|
|
12
|
+
ParamValue,
|
|
13
|
+
ParamValueOneOrMore,
|
|
14
|
+
ParamValueZeroOrMore,
|
|
15
|
+
ParamValueZeroOrOne,
|
|
16
|
+
} from 'vue-router'
|
|
17
|
+
import type {
|
|
18
|
+
_ExtractParamParserType,
|
|
19
|
+
} from 'vue-router/experimental'
|
|
20
|
+
|
|
21
|
+
declare module 'vue-router' {
|
|
22
|
+
interface TypesConfig {
|
|
23
|
+
_ParamParsers: {}
|
|
24
|
+
RouteNamedMap: import('vue-router/auto-routes').RouteNamedMap
|
|
25
|
+
_RouteFileInfoMap: import('vue-router/auto-routes')._RouteFileInfoMap
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module 'vue-router/auto-routes' {
|
|
30
|
+
/**
|
|
31
|
+
* Route name map generated by vue-router
|
|
32
|
+
*/
|
|
33
|
+
export interface RouteNamedMap {
|
|
34
|
+
'/': RouteRecordInfo<
|
|
35
|
+
'/',
|
|
36
|
+
'/',
|
|
37
|
+
Record<never, never>,
|
|
38
|
+
Record<never, never>,
|
|
39
|
+
| never
|
|
40
|
+
>,
|
|
41
|
+
'/[...all]': RouteRecordInfo<
|
|
42
|
+
'/[...all]',
|
|
43
|
+
'/:all(.*)',
|
|
44
|
+
{ all: ParamValue<true> },
|
|
45
|
+
{ all: ParamValue<false> },
|
|
46
|
+
| never
|
|
47
|
+
>,
|
|
48
|
+
'/article/[id]': RouteRecordInfo<
|
|
49
|
+
'/article/[id]',
|
|
50
|
+
'/article/:id',
|
|
51
|
+
{ id: ParamValue<true> },
|
|
52
|
+
{ id: ParamValue<false> },
|
|
53
|
+
| never
|
|
54
|
+
>,
|
|
55
|
+
'/test': RouteRecordInfo<
|
|
56
|
+
'/test',
|
|
57
|
+
'/test',
|
|
58
|
+
Record<never, never>,
|
|
59
|
+
Record<never, never>,
|
|
60
|
+
| never
|
|
61
|
+
>,
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Route file to route info map by vue-router.
|
|
66
|
+
* Used by the \`sfc-typed-router\` Volar plugin to automatically type \`useRoute()\`.
|
|
67
|
+
*
|
|
68
|
+
* Each key is a file path relative to the project root with 2 properties:
|
|
69
|
+
* - routes: union of route names of the possible routes when in this page (passed to useRoute<...>())
|
|
70
|
+
* - views: names of nested views (can be passed to <RouterView name="...">)
|
|
71
|
+
*
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
export interface _RouteFileInfoMap {
|
|
75
|
+
'src/pages/index.vue': {
|
|
76
|
+
routes:
|
|
77
|
+
| '/'
|
|
78
|
+
views:
|
|
79
|
+
| never
|
|
80
|
+
pathParamNames:
|
|
81
|
+
| never
|
|
82
|
+
}
|
|
83
|
+
'src/pages/[...all].vue': {
|
|
84
|
+
routes:
|
|
85
|
+
| '/[...all]'
|
|
86
|
+
views:
|
|
87
|
+
| never
|
|
88
|
+
pathParamNames:
|
|
89
|
+
| 'all'
|
|
90
|
+
}
|
|
91
|
+
'src/pages/article/[id].vue': {
|
|
92
|
+
routes:
|
|
93
|
+
| '/article/[id]'
|
|
94
|
+
views:
|
|
95
|
+
| never
|
|
96
|
+
pathParamNames:
|
|
97
|
+
| 'id'
|
|
98
|
+
}
|
|
99
|
+
'src/pages/test.vue': {
|
|
100
|
+
routes:
|
|
101
|
+
| '/test'
|
|
102
|
+
views:
|
|
103
|
+
| never
|
|
104
|
+
pathParamNames:
|
|
105
|
+
| never
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Get a union of possible route names in a certain route component file.
|
|
111
|
+
* Used by the \`sfc-typed-router\` Volar plugin to automatically type \`useRoute()\`.
|
|
112
|
+
*
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
export type _RouteNamesForFilePath<FilePath extends string> =
|
|
116
|
+
_RouteFileInfoMap extends Record<FilePath, infer Info>
|
|
117
|
+
? Info['routes']
|
|
118
|
+
: keyof RouteNamedMap
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export {}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineConfig,
|
|
3
|
+
presetAttributify,
|
|
4
|
+
presetIcons,
|
|
5
|
+
presetWebFonts,
|
|
6
|
+
presetWind3,
|
|
7
|
+
} from 'unocss'
|
|
8
|
+
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
shortcuts: [
|
|
11
|
+
['btn', 'rounded-2 border border-color-transparent px-2 py-1 cursor-pointer transition-duration-250 transition-property-border-color bg-#f9f9f9 color-black hover:border-color-#646cff inline-block'],
|
|
12
|
+
],
|
|
13
|
+
presets: [
|
|
14
|
+
presetWind3(),
|
|
15
|
+
presetAttributify(),
|
|
16
|
+
presetIcons({
|
|
17
|
+
scale: 1.2,
|
|
18
|
+
warn: true,
|
|
19
|
+
}),
|
|
20
|
+
presetWebFonts({
|
|
21
|
+
provider: 'none',
|
|
22
|
+
fonts: {
|
|
23
|
+
sans: 'DM Sans',
|
|
24
|
+
serif: 'DM Serif Display',
|
|
25
|
+
mono: 'DM Mono',
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
],
|
|
29
|
+
})
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import Vue from '@vitejs/plugin-vue'
|
|
3
|
+
import UnoCSS from 'unocss/vite'
|
|
4
|
+
import AutoImport from 'unplugin-auto-import/vite'
|
|
5
|
+
import IconsResolver from 'unplugin-icons/resolver'
|
|
6
|
+
import Icons from 'unplugin-icons/vite'
|
|
7
|
+
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
8
|
+
import Components from 'unplugin-vue-components/vite'
|
|
9
|
+
import { defineConfig } from 'vite'
|
|
10
|
+
import VueDevTools from 'vite-plugin-vue-devtools'
|
|
11
|
+
import svgLoader from 'vite-svg-loader'
|
|
12
|
+
import { VueRouterAutoImports } from 'vue-router/unplugin'
|
|
13
|
+
import VueRouter from 'vue-router/vite'
|
|
14
|
+
|
|
15
|
+
export default defineConfig({
|
|
16
|
+
resolve: {
|
|
17
|
+
alias: {
|
|
18
|
+
'~': path.resolve(import.meta.dirname, 'src'),
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
plugins: [
|
|
22
|
+
VueRouter(),
|
|
23
|
+
UnoCSS(),
|
|
24
|
+
Vue(),
|
|
25
|
+
VueDevTools(),
|
|
26
|
+
svgLoader(),
|
|
27
|
+
Icons({
|
|
28
|
+
autoInstall: true,
|
|
29
|
+
}),
|
|
30
|
+
AutoImport({
|
|
31
|
+
resolvers: [
|
|
32
|
+
ElementPlusResolver(),
|
|
33
|
+
IconsResolver(),
|
|
34
|
+
],
|
|
35
|
+
imports: [
|
|
36
|
+
'vue',
|
|
37
|
+
'@vueuse/core',
|
|
38
|
+
VueRouterAutoImports,
|
|
39
|
+
],
|
|
40
|
+
dts: true,
|
|
41
|
+
vueTemplate: true,
|
|
42
|
+
dirs: ['./src/composables'],
|
|
43
|
+
}),
|
|
44
|
+
Components({
|
|
45
|
+
dts: true,
|
|
46
|
+
resolvers: [
|
|
47
|
+
ElementPlusResolver(),
|
|
48
|
+
IconsResolver({
|
|
49
|
+
enabledCollections: ['ep'],
|
|
50
|
+
}),
|
|
51
|
+
],
|
|
52
|
+
}),
|
|
53
|
+
],
|
|
54
|
+
css: {
|
|
55
|
+
preprocessorOptions: {
|
|
56
|
+
scss: {
|
|
57
|
+
additionalData: `@use '~/styles/variables.scss' as *;`,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
build: {
|
|
62
|
+
// minify: 'oxc', // vite8默认
|
|
63
|
+
rolldownOptions: {
|
|
64
|
+
output: {
|
|
65
|
+
minify: {
|
|
66
|
+
compress: {
|
|
67
|
+
dropConsole: true,
|
|
68
|
+
dropDebugger: true,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
server: {
|
|
75
|
+
open: true,
|
|
76
|
+
host: true,
|
|
77
|
+
proxy: {
|
|
78
|
+
'/api': {
|
|
79
|
+
target: '',
|
|
80
|
+
changeOrigin: true,
|
|
81
|
+
rewrite: path => path.replace('/api', ''),
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
})
|