wanggang
1 year ago
27 changed files with 14173 additions and 0 deletions
@ -0,0 +1,13 @@ |
|||
root = true |
|||
|
|||
[*] |
|||
charset = utf-8 |
|||
indent_style = space |
|||
indent_size = 2 |
|||
end_of_line = lf |
|||
insert_final_newline = true |
|||
trim_trailing_whitespace = true |
|||
|
|||
[*.md] |
|||
trim_trailing_whitespace = false |
|||
|
@ -0,0 +1,3 @@ |
|||
package-lock.json |
|||
node_modules |
|||
dist |
@ -0,0 +1,51 @@ |
|||
const { readGitignoreFiles } = require('eslint-gitignore'); |
|||
|
|||
module.exports = { |
|||
root: true, |
|||
ignorePatterns: [...readGitignoreFiles()], |
|||
env: { |
|||
browser: true, |
|||
node: true, |
|||
}, |
|||
plugins: ['simple-import-sort'], |
|||
extends: [ |
|||
'eslint:recommended', |
|||
'plugin:import/recommended', |
|||
'plugin:vue/vue3-recommended', |
|||
'plugin:vue-scoped-css/vue3-recommended', |
|||
'airbnb-base', |
|||
'plugin:prettier/recommended', |
|||
// vite 启动时自动生成
|
|||
'./.eslintrc-auto-import.json', |
|||
], |
|||
parser: 'vue-eslint-parser', |
|||
parserOptions: { |
|||
ecmaVersion: 'latest', |
|||
sourceType: 'module', |
|||
ecmaFeatures: { |
|||
jsx: true, |
|||
}, |
|||
}, |
|||
rules: { |
|||
'simple-import-sort/imports': 'error', |
|||
'simple-import-sort/exports': 'error', |
|||
// import 可以从 devDependencies 中导入
|
|||
'import/no-extraneous-dependencies': ['error', { devDependencies: true }], |
|||
'import/no-unresolved': 'off', |
|||
'import/extensions': 'off', |
|||
'func-names': 'off', |
|||
'prefer-regex-literals': 'off', |
|||
'no-console': 'off', |
|||
'no-alert': 'off', |
|||
'no-return-assign': 'off', |
|||
'no-unused-expressions': 'off', |
|||
'no-param-reassign': 'off', |
|||
'no-unused-vars': 'warn', |
|||
'no-empty': 'warn', |
|||
'vue/multi-word-component-names': 'off', |
|||
'vue/no-v-html': 'off', |
|||
}, |
|||
globals: { |
|||
defineOptions: 'readonly', |
|||
}, |
|||
}; |
@ -0,0 +1,10 @@ |
|||
node_modules |
|||
dist |
|||
dist-ssr |
|||
.vite-inspect |
|||
# vscode local history plugin |
|||
*.local |
|||
# macOS |
|||
.DS_Store |
|||
# vite auto import plugin |
|||
.eslintrc-auto-import.json |
@ -0,0 +1,4 @@ |
|||
#!/usr/bin/env sh |
|||
. "$(dirname -- "$0")/_/husky.sh" |
|||
|
|||
npx lint-staged |
@ -0,0 +1,3 @@ |
|||
{ |
|||
"MD013": false |
|||
} |
@ -0,0 +1,2 @@ |
|||
**/node_modules |
|||
**/dist |
@ -0,0 +1 @@ |
|||
engine-strict = true |
@ -0,0 +1,6 @@ |
|||
node_modules |
|||
dist |
|||
package-lock.json |
|||
**/*.svg |
|||
index.html |
|||
/*.json |
@ -0,0 +1,21 @@ |
|||
module.exports = { |
|||
printWidth: 120, |
|||
tabWidth: 2, |
|||
useTabs: false, |
|||
semi: true, |
|||
singleQuote: true, |
|||
quoteProps: 'as-needed', |
|||
jsxSingleQuote: false, |
|||
trailingComma: 'all', |
|||
bracketSpacing: true, |
|||
arrowParens: 'always', |
|||
rangeStart: 0, |
|||
rangeEnd: Infinity, |
|||
requirePragma: false, |
|||
insertPragma: false, |
|||
proseWrap: 'preserve', |
|||
htmlWhitespaceSensitivity: 'css', |
|||
vueIndentScriptAndStyle: false, |
|||
singleAttributePerLine: true, |
|||
endOfLine: 'lf', |
|||
}; |
@ -0,0 +1,2 @@ |
|||
node_modules |
|||
dist |
@ -0,0 +1,20 @@ |
|||
module.exports = { |
|||
extends: [ |
|||
'stylelint-config-standard-scss', |
|||
'stylelint-config-html', |
|||
'stylelint-config-recommended-vue', |
|||
'stylelint-config-rational-order', |
|||
'stylelint-config-prettier-scss', |
|||
], |
|||
defaultSeverity: 'warning', |
|||
plugins: ['stylelint-order'], |
|||
rules: { |
|||
'at-rule-no-unknown': null, |
|||
'selector-class-pattern': [ |
|||
'^[a-z0-9-_]+$', |
|||
{ |
|||
message: 'Expected class selector to be kebab-case', |
|||
}, |
|||
], |
|||
}, |
|||
}; |
@ -0,0 +1,12 @@ |
|||
{ |
|||
"recommendations": [ |
|||
"howardzuo.vscode-npm-dependency", |
|||
"editorconfig.editorconfig", |
|||
"esbenp.prettier-vscode", |
|||
"dbaeumer.vscode-eslint", |
|||
"rvest.vs-code-prettier-eslint", |
|||
"stylelint.vscode-stylelint", |
|||
"davidanson.vscode-markdownlint", |
|||
"vue.volar" |
|||
] |
|||
} |
@ -0,0 +1,39 @@ |
|||
{ |
|||
"editor.formatOnSave": true, |
|||
"editor.formatOnSaveMode": "file", |
|||
"editor.formatOnPaste": false, |
|||
"editor.formatOnType": false, |
|||
"files.autoSave": "onFocusChange", |
|||
"eslint.alwaysShowStatus": true, |
|||
"eslint.probe": ["javascript", "javascriptreact", "typescript", "typescriptreact", "json", "vue", "jsx"], |
|||
"css.validate": false, |
|||
"less.validate": false, |
|||
"scss.validate": false, |
|||
"stylelint.validate": ["css", "less", "sass", "postcss", "vue"], |
|||
"editor.codeActionsOnSave": { |
|||
"source.fixAll.eslint": true, |
|||
"source.fixAll.stylelint": true |
|||
}, |
|||
"[html]": { |
|||
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint" |
|||
}, |
|||
"[javascript]": { |
|||
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint" |
|||
}, |
|||
"[json]": { |
|||
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint" |
|||
}, |
|||
"[css]": { |
|||
"editor.defaultFormatter": "stylelint.vscode-stylelint" |
|||
}, |
|||
"[scss]": { |
|||
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint" |
|||
}, |
|||
"[markdown]": { |
|||
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint" |
|||
}, |
|||
"[vue]": { |
|||
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint" |
|||
}, |
|||
"prettier.printWidth": 120 |
|||
} |
@ -0,0 +1,7 @@ |
|||
# Vue 3 + Vite |
|||
|
|||
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more. |
|||
|
|||
## Recommended IDE Setup |
|||
|
|||
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). |
@ -0,0 +1,51 @@ |
|||
const { readGitignoreFiles } = require('eslint-gitignore'); |
|||
|
|||
module.exports = { |
|||
root: true, |
|||
ignorePatterns: [...readGitignoreFiles()], |
|||
env: { |
|||
browser: true, |
|||
node: true, |
|||
}, |
|||
plugins: ['simple-import-sort'], |
|||
extends: [ |
|||
'eslint:recommended', |
|||
'plugin:import/recommended', |
|||
'plugin:vue/vue3-recommended', |
|||
'plugin:vue-scoped-css/vue3-recommended', |
|||
'airbnb-base', |
|||
'plugin:prettier/recommended', |
|||
// vite 启动时自动生成
|
|||
'./.eslintrc-auto-import.json', |
|||
], |
|||
parser: 'vue-eslint-parser', |
|||
parserOptions: { |
|||
ecmaVersion: 'latest', |
|||
sourceType: 'module', |
|||
ecmaFeatures: { |
|||
jsx: true, |
|||
}, |
|||
}, |
|||
rules: { |
|||
'simple-import-sort/imports': 'error', |
|||
'simple-import-sort/exports': 'error', |
|||
// import 可以从 devDependencies 中导入
|
|||
'import/no-extraneous-dependencies': ['error', { devDependencies: true }], |
|||
'import/no-unresolved': 'off', |
|||
'import/extensions': 'off', |
|||
'func-names': 'off', |
|||
'prefer-regex-literals': 'off', |
|||
'no-console': 'off', |
|||
'no-alert': 'off', |
|||
'no-return-assign': 'off', |
|||
'no-unused-expressions': 'off', |
|||
'no-param-reassign': 'off', |
|||
'no-unused-vars': 'warn', |
|||
'no-empty': 'warn', |
|||
'vue/multi-word-component-names': 'off', |
|||
'vue/no-v-html': 'off', |
|||
}, |
|||
globals: { |
|||
defineOptions: 'readonly', |
|||
}, |
|||
}; |
@ -0,0 +1,13 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="UTF-8" /> |
|||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
|||
<title>Vite + Vue</title> |
|||
</head> |
|||
<body> |
|||
<div id="app"></div> |
|||
<script type="module" src="/src/main.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,10 @@ |
|||
{ |
|||
"exclude": ["node_modules"], |
|||
"compilerOptions": { |
|||
"baseUrl": ".", |
|||
"paths": { |
|||
"~/*": ["src/*"] |
|||
}, |
|||
"jsx": "preserve" |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,113 @@ |
|||
{ |
|||
"name": "web-template-vue", |
|||
"private": true, |
|||
"version": "0.1.0", |
|||
"engineStrict": true, |
|||
"engines": { |
|||
"node": ">=16", |
|||
"npm": ">=8" |
|||
}, |
|||
"scripts": { |
|||
"dev": "vite", |
|||
"dev:mock": "vite --mode mock", |
|||
"build": "vite build", |
|||
"preview": "vite preview", |
|||
"lint": "eslint . --ext .js,.jsx,.vue && stylelint \"**/*.{css,scss,html,vue}\" && markdownlint \"**/*.md\"", |
|||
"lint:fix": "eslint --fix --ext .js,.jsx,.vue && stylelint \"**/*.{css,scss,html,vue}\" --fix && markdownlint \"**/*.md\" --fix && prettier --write .", |
|||
"lint-staged": "npx lint-staged", |
|||
"prepare": "cd ../../../&&husky install code/WebApp/vue3/.husky" |
|||
}, |
|||
"lint-staged": { |
|||
"*.{js,ts,jsx,tsx}": [ |
|||
"prettier --write", |
|||
"eslint --fix", |
|||
"git add ." |
|||
], |
|||
"*.vue": [ |
|||
"stylelint --fix", |
|||
"prettier --write", |
|||
"eslint --fix", |
|||
"git add ." |
|||
], |
|||
"*.{css,less,scss}": [ |
|||
"stylelint --fix", |
|||
"prettier --write", |
|||
"git add ." |
|||
], |
|||
"*.md": [ |
|||
"markdownlint --fix", |
|||
"prettier --write", |
|||
"git add ." |
|||
] |
|||
}, |
|||
"dependencies": { |
|||
"@ckeditor/ckeditor5-build-classic": "^38.0.1", |
|||
"@ckeditor/ckeditor5-upload": "^38.0.1", |
|||
"@ckeditor/ckeditor5-vue": "^5.1.0", |
|||
"@vueuse/core": "^10.2.0", |
|||
"async-validator": "^4.2.5", |
|||
"axios": "^1.4.0", |
|||
"better-mock": "^0.3.6", |
|||
"dayjs": "^1.11.8", |
|||
"echarts": "^5.4.2", |
|||
"element-plus": "^2.3.7", |
|||
"javascript-state-machine": "^3.1.0", |
|||
"jose": "^4.14.4", |
|||
"jsrsasign": "^10.8.6", |
|||
"linq": "^4.0.1", |
|||
"localforage": "^1.10.0", |
|||
"lodash": "^4.17.21", |
|||
"lodash-es": "^4.17.21", |
|||
"loglevel": "^1.8.1", |
|||
"mitt": "^3.0.0", |
|||
"mrmime": "^1.0.1", |
|||
"nprogress": "^0.2.0", |
|||
"pinia": "^2.1.4", |
|||
"qrcode.vue": "^3.4.0", |
|||
"qs": "^6.11.2", |
|||
"query-string": "^8.1.0", |
|||
"vant": "4.6.0", |
|||
"vue": "^3.3.4", |
|||
"vue-echarts": "^6.6.0", |
|||
"vue-i18n": "^9.2.2", |
|||
"vue-router": "^4.2.2", |
|||
"wsmock-js": "^1.1.1" |
|||
}, |
|||
"devDependencies": { |
|||
"@iconify/json": "^2.2.83", |
|||
"@unocss/preset-attributify": "^0.53.4", |
|||
"@unocss/preset-uno": "^0.53.4", |
|||
"@vitejs/plugin-vue": "^4.2.3", |
|||
"@vitejs/plugin-vue-jsx": "^3.0.1", |
|||
"eslint": "^8.43.0", |
|||
"eslint-config-airbnb-base": "^15.0.0", |
|||
"eslint-config-prettier": "^8.8.0", |
|||
"eslint-gitignore": "^0.1.0", |
|||
"eslint-plugin-import": "^2.27.5", |
|||
"eslint-plugin-prettier": "^4.2.1", |
|||
"eslint-plugin-simple-import-sort": "^10.0.0", |
|||
"eslint-plugin-vue": "^9.15.1", |
|||
"eslint-plugin-vue-scoped-css": "^2.4.0", |
|||
"husky": "^8.0.3", |
|||
"lint-staged": "^13.2.2", |
|||
"markdownlint-cli": "^0.35.0", |
|||
"prettier": "^2.8.8", |
|||
"sass": "^1.63.6", |
|||
"stylelint": "^15.9.0", |
|||
"stylelint-config-html": "^1.1.0", |
|||
"stylelint-config-prettier-scss": "^1.0.0", |
|||
"stylelint-config-rational-order": "^0.1.2", |
|||
"stylelint-config-recommended-vue": "^1.4.0", |
|||
"stylelint-config-standard-scss": "^9.0.0", |
|||
"stylelint-order": "^6.0.3", |
|||
"unocss": "^0.53.4", |
|||
"unplugin-auto-import": "^0.16.4", |
|||
"unplugin-icons": "^0.16.3", |
|||
"unplugin-vue-components": "^0.25.1", |
|||
"unplugin-vue-define-options": "^1.3.8", |
|||
"vite": "^4.3.9", |
|||
"vite-plugin-inspect": "^0.7.29", |
|||
"vite-svg-loader": "^4.0.0", |
|||
"vue-eslint-parser": "^9.3.1" |
|||
} |
|||
} |
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,46 @@ |
|||
<script setup> |
|||
import HelloWorld from './components/HelloWorld.vue'; |
|||
</script> |
|||
|
|||
<template> |
|||
<div> |
|||
<a |
|||
href="https://vitejs.dev" |
|||
target="_blank" |
|||
> |
|||
<img |
|||
src="/vite.svg" |
|||
class="logo" |
|||
alt="Vite logo" |
|||
/> |
|||
</a> |
|||
<a |
|||
href="https://vuejs.org/" |
|||
target="_blank" |
|||
> |
|||
<img |
|||
src="./assets/vue.svg" |
|||
class="logo vue" |
|||
alt="Vue logo" |
|||
/> |
|||
</a> |
|||
</div> |
|||
<HelloWorld msg="Vite + Vue" /> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
.logo { |
|||
height: 6em; |
|||
padding: 1.5em; |
|||
transition: filter 300ms; |
|||
will-change: filter; |
|||
} |
|||
|
|||
.logo:hover { |
|||
filter: drop-shadow(0 0 2em #646cffaa); |
|||
} |
|||
|
|||
.logo.vue:hover { |
|||
filter: drop-shadow(0 0 2em #42b883aa); |
|||
} |
|||
</style> |
After Width: | Height: | Size: 496 B |
@ -0,0 +1,51 @@ |
|||
<script setup> |
|||
import { ref } from 'vue'; |
|||
|
|||
defineProps({ |
|||
msg: { type: String, default: '' }, |
|||
}); |
|||
|
|||
const count = ref(0); |
|||
</script> |
|||
|
|||
<template> |
|||
<h1>{{ msg }}</h1> |
|||
|
|||
<div class="card"> |
|||
<button |
|||
type="button" |
|||
@click="count++" |
|||
> |
|||
count is {{ count }} |
|||
</button> |
|||
<p> |
|||
Edit |
|||
<code>components/HelloWorld.vue</code> to test HMR |
|||
</p> |
|||
</div> |
|||
|
|||
<p> |
|||
Check out |
|||
<a |
|||
href="https://vuejs.org/guide/quick-start.html#local" |
|||
target="_blank" |
|||
>create-vue</a |
|||
>, the official Vue + Vite starter |
|||
</p> |
|||
<p> |
|||
Install |
|||
<a |
|||
href="https://github.com/vuejs/language-tools" |
|||
target="_blank" |
|||
>Volar</a |
|||
> |
|||
in your IDE for a better DX |
|||
</p> |
|||
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
.read-the-docs { |
|||
color: #888; |
|||
} |
|||
</style> |
@ -0,0 +1,7 @@ |
|||
import './style.css'; |
|||
|
|||
import { createApp } from 'vue'; |
|||
|
|||
import App from './App.vue'; |
|||
|
|||
createApp(App).mount('#app'); |
@ -0,0 +1,83 @@ |
|||
:root { |
|||
color: rgb(255 255 255 / 87%); |
|||
font-weight: 400; |
|||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; |
|||
line-height: 1.5; |
|||
background-color: #242424; |
|||
color-scheme: light dark; |
|||
font-synthesis: none; |
|||
text-rendering: optimizelegibility; |
|||
-webkit-font-smoothing: antialiased; |
|||
-moz-osx-font-smoothing: grayscale; |
|||
text-size-adjust: 100%; |
|||
} |
|||
|
|||
a { |
|||
color: #646cff; |
|||
font-weight: 500; |
|||
text-decoration: inherit; |
|||
} |
|||
|
|||
a:hover { |
|||
color: #535bf2; |
|||
} |
|||
|
|||
body { |
|||
display: flex; |
|||
min-width: 320px; |
|||
min-height: 100vh; |
|||
margin: 0; |
|||
place-items: center; |
|||
} |
|||
|
|||
h1 { |
|||
font-size: 3.2em; |
|||
line-height: 1.1; |
|||
} |
|||
|
|||
button { |
|||
padding: 0.6em 1.2em; |
|||
font-weight: 500; |
|||
font-size: 1em; |
|||
font-family: inherit; |
|||
background-color: #1a1a1a; |
|||
border: 1px solid transparent; |
|||
border-radius: 8px; |
|||
cursor: pointer; |
|||
transition: border-color 0.25s; |
|||
} |
|||
|
|||
button:hover { |
|||
border-color: #646cff; |
|||
} |
|||
|
|||
button:focus, |
|||
button:focus-visible { |
|||
outline: 4px auto -webkit-focus-ring-color; |
|||
} |
|||
|
|||
.card { |
|||
padding: 2em; |
|||
} |
|||
|
|||
#app { |
|||
max-width: 1280px; |
|||
margin: 0 auto; |
|||
padding: 2rem; |
|||
text-align: center; |
|||
} |
|||
|
|||
@media (prefers-color-scheme: light) { |
|||
:root { |
|||
color: #213547; |
|||
background-color: #fff; |
|||
} |
|||
|
|||
a:hover { |
|||
color: #747bff; |
|||
} |
|||
|
|||
button { |
|||
background-color: #f9f9f9; |
|||
} |
|||
} |
@ -0,0 +1,62 @@ |
|||
import presetAttributify from '@unocss/preset-attributify'; |
|||
import presetUno from '@unocss/preset-uno'; |
|||
import vue from '@vitejs/plugin-vue'; |
|||
import vueJsx from '@vitejs/plugin-vue-jsx'; |
|||
import unocss from 'unocss/vite'; |
|||
import autoImport from 'unplugin-auto-import/vite'; |
|||
import IconsResolver from 'unplugin-icons/resolver'; |
|||
import icons from 'unplugin-icons/vite'; |
|||
import { ElementPlusResolver, VantResolver } from 'unplugin-vue-components/resolvers'; |
|||
import components from 'unplugin-vue-components/vite'; |
|||
import DefineOptions from 'unplugin-vue-define-options/vite'; |
|||
import { defineConfig } from 'vite'; |
|||
import inspect from 'vite-plugin-inspect'; |
|||
import svgLoader from 'vite-svg-loader'; |
|||
|
|||
const autoImportOptions = { |
|||
imports: ['vue', 'vue-router', 'pinia', '@vueuse/core'], |
|||
dirs: ['src/components'], |
|||
vueTemplate: true, |
|||
eslintrc: { |
|||
enabled: true, |
|||
}, |
|||
}; |
|||
|
|||
const componentoptions = { |
|||
resolvers: [ |
|||
IconsResolver({ |
|||
enabledCollections: ['ep'], |
|||
}), |
|||
ElementPlusResolver(), |
|||
VantResolver(), |
|||
], |
|||
}; |
|||
|
|||
const unocssOptions = { |
|||
presets: [presetAttributify(), presetUno()], |
|||
}; |
|||
|
|||
export default defineConfig({ |
|||
base: '/web-template-vue/', |
|||
build: { |
|||
target: 'esnext', // top await
|
|||
module: 'esm', |
|||
}, |
|||
resolve: { |
|||
alias: { |
|||
'~/': new URL('./src/', import.meta.url).pathname, |
|||
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js', |
|||
}, |
|||
}, |
|||
plugins: [ |
|||
vue(), |
|||
vueJsx(), |
|||
DefineOptions(), |
|||
inspect(), |
|||
autoImport(autoImportOptions), |
|||
unocss(unocssOptions), |
|||
icons(), |
|||
svgLoader(), |
|||
components(componentoptions), |
|||
], |
|||
}); |
Loading…
Reference in new issue