Skip to content

Commit

Permalink
feature: 修改问题
Browse files Browse the repository at this point in the history
  • Loading branch information
jsxiaosi committed Jun 19, 2021
1 parent c48b395 commit 5387127
Show file tree
Hide file tree
Showing 28 changed files with 324 additions and 261 deletions.
14 changes: 8 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@ module.exports = {
root: true,
env: {
browser: true,
es6: true,
node: true,
commonjs: true,
es6: true,
node: true
},
extends: ['standard', 'plugin:vue/essential', 'plugin:prettier/recommended'],
parserOptions: {
ecmaVersion: 12,
ecmaVersion: 2016,
// 对Babel解析器的包装使其与 ESLint 兼容。
parser: 'babel-eslint',
// 代码是 ECMAScript 模块
sourceType: 'module',
},
plugins: ['vue'],
rules: {
'prettier/prettier': 'error',
// 'prettier/prettier': 'error',
'no-unused-vars': 'off',
'vue/no-multiple-template-root': 'off',
camelcase: 0,
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'vue/component-tags-order': [
'error',
{
Expand Down
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --edit $1
8 changes: 8 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# 已存在文件只需添加以下命令
npx eslint --fix --ext src/**/*.{vue}
npx prettier --write --loglevel warn src/**/*.{js,scss,vue}
npx stylelint --fix src/**/*.{vue,scss} --cache --cache-location node_modules/.cache/stylelint/
git add .
4 changes: 1 addition & 3 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ module.exports = {
rules: {
'type-enum': [2, 'always', [
'feature', 'fixbug', 'refactor', 'docs', 'style', 'perf', 'chore', 'revert'
]],
'subject-full-stop': [0, 'never'],
'subject-case': [0, 'never'],
]]
}
}
55 changes: 55 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@vitejs/plugin-vue": "^1.2.3",
"@vue/compiler-sfc": "^3.0.5",
"@zougt/vite-plugin-theme-preprocessor": "^1.0.0",
"babel-eslint": "^10.1.0",
"commitizen": "^4.2.4",
"cz-conventional-changelog": "^3.2.0",
"eslint": "^7.28.0",
Expand Down
2 changes: 1 addition & 1 deletion prettier.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
// 行尾逗号,默认none,可选 none|es5|all
// es5 包括es5中的数组、对象
// all 包括函数对象等所有可选
TrailingCooma: 'none',
// TrailingCooma: 'none',
// 对象中的空格 默认trueÏ
// true: { foo: bar }
// false: {foo: bar}
Expand Down
28 changes: 14 additions & 14 deletions src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<template>
<h1>{{ msg }}</h1>
<h1>{{ msg }}</h1>

<p>
<a href="https://vitejs.dev/guide/features.html" target="_blank">
Vite Documentation
</a>
|
<a href="https://v3.vuejs.org/" target="_blank">Vue 3 Documentation</a>
</p>
<p>
<a href="https://vitejs.dev/guide/features.html" target="_blank">
Vite Documentation
</a>
|
<a href="https://v3.vuejs.org/" target="_blank">Vue 3 Documentation</a>
</p>

<button @click="state.count++">count is: {{ state.count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test hot module replacement.
</p>
<button @click="state.count++">count is: {{ state.count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test hot module replacement.
</p>
</template>

<script setup>
import { defineProps, reactive } from 'vue'
defineProps({
msg: String
msg: String,
})
const state = reactive({ count: 0 })
Expand Down
1 change: 0 additions & 1 deletion src/layouts/components/Sidebar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { computed } from 'vue'
import { useRoute } from 'vue-router'
import SidebarItem from './SidebarItem.vue'
import { safeManagerRoutes } from '@/router/otherRoute'
import variables from '@/styles/variables.module.scss'
const activeMenyu = computed(() => {
const route = useRoute()
Expand Down
31 changes: 15 additions & 16 deletions src/layouts/index.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<template>
<div class="app-wrapper">
<!-- 顶部导航栏 -->
<NavBart />
<!-- 侧边导航栏 -->
<Sidebar class="sidebar-container" />
<div class="main-container">
<div class="main-container-breadcrumb">
<!-- 面包屑 -->
<Breadcrumb />
</div>
<!-- 内容区 -->
<AppMain />
</div>
</div>
<div class="app-wrapper">
<!-- 顶部导航栏 -->
<NavBart />
<!-- 侧边导航栏 -->
<Sidebar class="sidebar-container" />
<div class="main-container">
<div class="main-container-breadcrumb">
<!-- 面包屑 -->
<Breadcrumb />
</div>
<!-- 内容区 -->
<AppMain />
</div>
</div>
</template>

<script setup>
Expand All @@ -22,5 +22,4 @@ import Sidebar from './components/Sidebar/index.vue'
import Breadcrumb from './components/Breadcrumb/Breadcrumb.vue'
</script>

<style lang="scss" scoped>
</style>
<style lang="scss" scoped></style>
8 changes: 4 additions & 4 deletions src/locales/en.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import enLocale from 'element-plus/lib/locale/lang/en'

export const lang = {
el: enLocale.el,
login: {
title: 'login'
}
el: enLocale.el,
login: {
title: 'login',
},
}
18 changes: 8 additions & 10 deletions src/locales/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ import { createI18n } from 'vue-i18n'
import ElementLocale from 'element-plus/lib/locale'

const messages = Object.fromEntries(
Object.entries(
import.meta.globEager('./**.js'))
.map(([key, value]) => {
console.log(value)
return [key.match(/^\.\/([\s\S]+)\.js$/)[1], value.lang]
})
Object.entries(import.meta.globEager('./**.js')).map(([key, value]) => {
console.log(value)
return [key.match(/^\.\/([\s\S]+)\.js$/)[1], value.lang]
})
)

const i18n = createI18n({
legacy: false,
locale: 'zh-tw',
fallbackLocale: 'zh-tw',
messages
legacy: false,
locale: 'zh-tw',
fallbackLocale: 'zh-tw',
messages,
})

export default i18n
8 changes: 4 additions & 4 deletions src/locales/zh-tw.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import zhTWLocale from 'element-plus/lib/locale/lang/zh-tw'

console.log(zhTWLocale)
export const lang = {
el: zhTWLocale.el,
login: {
title: '登錄'
}
el: zhTWLocale.el,
login: {
title: '登錄',
},
}
17 changes: 8 additions & 9 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ import { safeManagerRoutes } from './otherRoute'
// import Layout from '@/layouts/index.vue'

const routes = [
...safeManagerRoutes, // 管理端
{
path: '/',
redirect: '/useradmin',
meta: { title: '用户管理' }
}

...safeManagerRoutes, // 管理端
{
path: '/',
redirect: '/useradmin',
meta: { title: '用户管理' },
},
]

export default createRouter({
history: createWebHistory(''),
routes
history: createWebHistory(''),
routes,
})
Loading

0 comments on commit 5387127

Please sign in to comment.