chore: 初始化文件结构

This commit is contained in:
2024-08-26 14:07:57 +08:00
parent d4f497f484
commit eb13a9efdb
24 changed files with 3035 additions and 0 deletions

4
.eslintignore Normal file
View File

@@ -0,0 +1,4 @@
dist
node_modules
types/env.d.ts
types/web.d.ts

18
.eslintrc.cjs Normal file
View File

@@ -0,0 +1,18 @@
/* eslint-env node */
module.exports = {
extends: [
'eslint:recommended',
'plugin:vue/vue3-essential',
],
parserOptions: {
ecmaVersion: 'latest',
},
root: true,
rules: {
'vue/html-self-closing': 'off',
'vue/max-attributes-per-line': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/require-default-prop': 'off',
'vue/singleline-html-element-content-newline': 'off',
},
};

6
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"recommendations": [
"Vue.volar",
"dbaeumer.vscode-eslint"
]
}

7
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"editor.tabSize": 2,
"editor.wordWrap": "on",
"files.autoSave": "off",
"files.eol": "\n",
"typescript.suggest.autoImports": false,
}

View File

@@ -1 +1,27 @@
# frost-navigation # frost-navigation
## Commands
### Project Setup
```sh
pnpm install
```
### Compile and Hot-Reload for Development
```sh
pnpm run dev
```
### Compile and Minify for Production
```sh
pnpm run build
```
### Lint with ESLint
```sh
pnpm run lint
```

13
index.html Normal file
View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Frost Navigation</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

20
jsconfig.app.json Normal file
View File

@@ -0,0 +1,20 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"composite": true,
"paths": {
"@/*": ["./src/*"],
"@package-json": ["./package.json"],
}
},
"exclude": [],
"include": [
"package.json",
"src/**/*.js",
"src/**/*.vue",
"types/env.d.ts",
"types/web.d.ts"
]
}

7
jsconfig.json Normal file
View File

@@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./jsconfig.node.json" },
{ "path": "./jsconfig.app.json" }
]
}

15
jsconfig.node.json Normal file
View File

@@ -0,0 +1,15 @@
{
"extends": "@tsconfig/node20/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"composite": true,
"noEmit": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["node"]
},
"exclude": [],
"include": [
"vite.config.js"
]
}

35
package.json Normal file
View File

@@ -0,0 +1,35 @@
{
"name": "frost-navigation",
"version": "3.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
},
"dependencies": {
"@frost-utils/javascript": "^2.1.3",
"@mdi/font": "^7.4.47",
"@vueuse/core": "^11.0.3",
"axios": "^1.7.5",
"naive-ui": "^2.39.0",
"radash": "^12.1.0",
"uuid": "^10.0.0",
"vue": "^3.4.29",
"vue-router": "^4.3.3",
"zxing-wasm": "^1.2.12"
},
"devDependencies": {
"@tsconfig/node20": "^20.1.4",
"@types/node": "^20.14.5",
"@types/uuid": "^10.0.0",
"@vitejs/plugin-vue": "^5.0.5",
"@vitejs/plugin-vue-jsx": "^4.0.0",
"@vue/tsconfig": "^0.5.1",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.23.0",
"less": "^4.2.0",
"vite": "^5.3.1"
}
}

2627
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

95
src/App.vue Normal file
View File

@@ -0,0 +1,95 @@
<template>
<n-config-provider
:date-locale="configProviderProps.dateLocale"
:inline-theme-disabled="configProviderProps.inlineThemeDisabled"
:locale="configProviderProps.locale"
>
<!-- Naive UI 全局样式 -->
<n-global-style></n-global-style>
<!-- 全局侧边栏 -->
<div class="app-aside"></div>
<!-- 路由页面 -->
<router-view class="app-view"></router-view>
</n-config-provider>
</template>
<script setup>
import {
NConfigProvider, NGlobalStyle,
} from 'naive-ui';
import {
configProviderProps,
} from './assets/js/naive-ui';
</script>
<style lang="less">
// 全局 CSS 变量
:root {
// 基础颜色
--color-black: #252525;
--color-gray: #E0E0E0;
// 分类颜色
--color-bg-dark: #252525;
--color-bg-light: #F8F8F8;
// 滚动条大小
--scrollbar-size: 8px;
}
// 滚动条
::-webkit-scrollbar {
width: var(--scrollbar-size);
height: var(--scrollbar-size);
}
::-webkit-scrollbar-corner {
display: none;
}
::-webkit-scrollbar-track {
background-color: transparent;
}
::-webkit-scrollbar-thumb {
border-radius: 16px;
background-color: #CFCFCF;
&:hover {
background-color: #C0C0C0;
}
}
html, body, #app, .n-config-provider {
width: 100%;
height: 100%;
overflow: hidden;
}
html, body {
user-select: none;
-webkit-tap-highlight-color: transparent;
}
html {
background-color: #FFF;
color: var(--color-black);
font-size: 16px;
}
.n-config-provider {
display: flex;
flex-direction: row
}
.app-aside, .app-view {
height: 100%;
}
.app-aside {
width: 80px;
}
.app-view {
flex-grow: 1;
width: 0;
}
</style>

13
src/assets/js/naive-ui.js Normal file
View File

@@ -0,0 +1,13 @@
import { dateZhCN, zhCN } from 'naive-ui';
/** @type { import('naive-ui').ConfigProviderProps } */
export const configProviderProps = {
// 语言
dateLocale: dateZhCN,
locale: zhCN,
// 禁用 inline 主题
inlineThemeDisabled: true,
};

9
src/main.js Normal file
View File

@@ -0,0 +1,9 @@
import { createApp } from 'vue';
import { router } from './router';
import App from './App.vue';
const app = createApp(App);
app.use(router);
app.mount('#app');

35
src/router/index.js Normal file
View File

@@ -0,0 +1,35 @@
import { createRouter, createWebHashHistory } from 'vue-router';
import AboutView from '@/views/AboutView/AboutView.vue';
import IndexView from '@/views/IndexView/IndexView.vue';
export const router = createRouter({
history: createWebHashHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'IndexView',
component: IndexView,
},
{
path: '/about-view',
name: 'AboutView',
component: AboutView,
},
{
path: '/nav-view',
name: 'NavView',
component: () => import('@/views/NavView/NavView.vue'),
},
{
path: '/search-view',
name: 'SearchView',
component: () => import('@/views/SearchView/SearchView.vue'),
},
{
path: '/toolbox-view',
name: 'ToolboxView',
component: () => import('@/views/ToolboxView/ToolboxView.vue'),
},
],
});

View File

@@ -0,0 +1,9 @@
<template>
<div class="about-view"></div>
</template>
<script setup>
</script>
<style lang="less" scoped>
</style>

View File

@@ -0,0 +1,9 @@
<template>
<div class="index-view"></div>
</template>
<script setup>
</script>
<style lang="less" scoped>
</style>

View File

@@ -0,0 +1,9 @@
<template>
<div class="nav-view"></div>
</template>
<script setup>
</script>
<style lang="less" scoped>
</style>

View File

@@ -0,0 +1,9 @@
<template>
<div class="search-view"></div>
</template>
<script setup>
</script>
<style lang="less" scoped>
</style>

View File

@@ -0,0 +1,9 @@
<template>
<div class="toolbox-view"></div>
</template>
<script setup>
</script>
<style lang="less" scoped>
</style>

4
types/env.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
}

29
types/web.d.ts vendored Normal file
View File

@@ -0,0 +1,29 @@
import type {
ComputedRef, DeepReadonly, PropType,
Ref, ShallowRef, UnwrapNestedRefs,
} from 'vue';
import type {
RouteLocationRaw,
} from 'vue-router';
declare global {
// window
interface Window {
}
// Vue
type VueComputedRef<T> = ComputedRef<T>;
type VuePropType<T> = PropType<T>;
type VueReactive<T> = UnwrapNestedRefs<T>;
type VueReadonly<T> = DeepReadonly<UnwrapNestedRefs<T>>;
type VueRef<T> = Ref<T>;
type VueShallowRef<T> = ShallowRef<T>;
// Vue Router
type VueRouteLocationRaw = RouteLocationRaw;
}
export { };

27
vite.config.js Normal file
View File

@@ -0,0 +1,27 @@
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
function getPath(url = '') {
return fileURLToPath(new URL(url, import.meta.url));
}
export default defineConfig({
base: './',
envPrefix: 'V_ENV_',
plugins: [
vue(),
vueJsx(),
],
resolve: {
alias: {
'@': getPath('./src'),
'@package-json': getPath('./package.json'),
},
},
server: {
port: 9000,
},
});