Skip to content

Commit

Permalink
update to v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kuanghua committed Nov 21, 2022
1 parent 0ef4c74 commit 3a9330e
Show file tree
Hide file tree
Showing 84 changed files with 507 additions and 398 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ pnpm*
auto-imports.d.ts
components.d.ts
stats.html
ts-out-dir
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
shamefully-hoist=true
strict-peer-dependencies=false

###aliyun address
registry = https://registry.npmmirror.com

107 changes: 0 additions & 107 deletions README-zh_CN.md

This file was deleted.

29 changes: 8 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,34 @@
# vue3-admin-ts

**English** | [中文](./README-zh_CN.md)

> A minimal vue3 admin template with Element-Plus UI & axios & permission control & lint & hook
A new generation admin construct using vue3(setup-script)+vite2+element-plus ,It's fast!

Use eslint+prettier+gitHooks format and verification code to improve code standardization and development efficiency
> the typescript version of vue3 admin template
suggestion the Node.js >= 16.0.0。


## Documents

- [Official Documentation](https://github.jzfai.top/vue3-admin-doc/)

- [中文官网](https://github.jzfai.top/vue3-admin-doc/zh/)


## Online experience

[github address](https://github.com/jzfai/vue3-admin-ts.git)

[Access address](https://github.jzfai.top/vue3-admin-ts)

## Online experience

国内体验地址:https://github.jzfai.top/vue3-admin-ts
[Access address](https://github.jzfai.top/vue3-admin-plus)

github 地址:https://github.com/jzfai/vue3-admin-ts.git
[国内体验地址](https://github.jzfai.top/vue3-admin-plus)



## Related items

The framework is available in js, ts , plus and electron versions
The framework is available in js,ts, plus and electron versions
- js version:[vue3-admin-template](https://github.com/jzfai/vue3-admin-template.git) -- basic version
- ts version:[vue3-element-ts](https://github.com/jzfai/vue3-admin-ts.git)
- js version for plus:[vue3-element-plus](https://github.com/jzfai/vue3-admin-plus.git)
- ts version for plus:[vue3-element-plus](https://github.com/jzfai/vue3-admin-plus.git)
- java Micro-service background data:[micro-service-plus](https://github.com/jzfai/micro-service-plus)
> development and experience:two words Really fragrant!!!!!


## Build Setup

Expand Down Expand Up @@ -80,10 +71,6 @@ pnpm run lint

```

## Extra

Architecture development is not easy. If you feel good, please give me a **start**. The architecture is still being improved. Welcome to join me in development and become Contributors together! ! ! !


## Browsers support

Expand Down
34 changes: 17 additions & 17 deletions eslintrc/eslint-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,23 @@ module.exports = defineConfig({
//fix lf error
'prettier/prettier': 'off',
// import
// 'import/first': 'error',
// 'import/no-duplicates': 'error',
// 'import/order': [
// 'error',
// {
// groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
//
// pathGroups: [
// {
// pattern: 'vue',
// group: 'external',
// position: 'before'
// }
// ],
// pathGroupsExcludedImportTypes: ['type']
// }
// ],
'import/first': 'error',
'import/no-duplicates': 'error',
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],

pathGroups: [
{
pattern: 'vue',
group: 'external',
position: 'before'
}
],
pathGroupsExcludedImportTypes: ['type']
}
],
'import/no-unresolved': 'off',
'import/namespace': 'off',
'import/default': 'off',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue3-admin-ts",
"version": "2.0.0-rc3",
"version": "2.0.0",
"license": "MIT",
"author": "kuanghua",
"packageManager": "[email protected]",
Expand Down
25 changes: 19 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
<template>
<el-config-provider :locale="locale" namespace="el" :size="size">
<el-config-provider :locale="lang[language]" namespace="el" :size="size">
<router-view />
</el-config-provider>
</template>
<script setup lang="ts">
import { onBeforeMount, onMounted } from 'vue'
import zhCn from 'element-plus/lib/locale/lang/zh-cn'
//element-plus lang
import zh from 'element-plus/lib/locale/lang/zh-cn'
import en from 'element-plus/es/locale/lang/en'
import { storeToRefs } from 'pinia/dist/pinia'
import { useRoute } from 'vue-router'
import { useBasicStore } from '@/store/basic'
import { useConfigStore } from '@/store/config'
import { useErrorLog } from '@/hooks/use-error-log'
const locale = ref(zhCn) //中文
// import en from 'element-plus/lib/locale/lang/en'
// let locale = ref(en) //english
//reshow default setting
import { toggleHtmlClass } from '@/theme/utils'
const lang = { zh, en }
const { settings } = storeToRefs(useBasicStore())
const { size } = storeToRefs(useConfigStore())
const { size, language } = storeToRefs(useConfigStore())
onBeforeMount(() => {
//set tmp token when setting isNeedLogin false
if (!settings.value.isNeedLogin) useBasicStore().setToken(settings.value.tmpToken)
Expand All @@ -23,6 +28,14 @@ onMounted(() => {
//lanch the errorLog collection
useErrorLog()
})
const route = useRoute()
onMounted(() => {
const { setTheme, theme, setSize, size, setLanguage, language } = useConfigStore()
setTheme(theme)
setLanguage(language, route.meta?.title)
setSize(size)
toggleHtmlClass(theme)
})
</script>
<style lang="scss">
//修改进度条样式
Expand Down
1 change: 0 additions & 1 deletion src/components/__tests__/el-svgIcon.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import ElSvgIcon from '../ElSvgIcon.vue'
describe('ElSvgIcon.vue', () => {
it('create', () => {
const wrapper = mount(() => <ElSvgIcon name="Edit" size={30} color={'red'} />)

// console.log(111111, wrapper.classes())
// expect(wrapper.classes()).toContain('el-icon')
})
Expand Down
4 changes: 2 additions & 2 deletions src/directives/lang.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { watch } from 'vue'
import { storeToRefs } from 'pinia/dist/pinia'
import { langTitle } from '@/hooks/use-common'
import { useConfigStore } from '@/store/config'
import { storeToRefs } from 'pinia/dist/pinia'

//element-plus
const componentToProps = {
ElInput: 'placeholder',
Expand Down
15 changes: 11 additions & 4 deletions src/hooks/use-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
import useClipboard from 'vue-clipboard3'
import { ElMessage } from 'element-plus'

// i18n language match title
import { i18n } from '@/lang'
// the keys using zh file
import langEn from '@/lang/zh'

export const sleepTimeout = (time: number) => {
return new Promise((resolve) => {
const timer = setTimeout(() => {
Expand All @@ -16,16 +21,13 @@ export function cloneDeep(value) {
return JSON.parse(JSON.stringify(value))
}

//copyValueToClipboard
const { toClipboard } = useClipboard()
export const copyValueToClipboard = (value: any) => {
toClipboard(JSON.stringify(value))
ElMessage.success('复制成功')
}

// i18n language match title
import { i18n } from '@/lang'
const { t, te } = i18n.global
import langEn from '@/lang/en'
export const langTitle = (title) => {
for (const key of Object.keys(langEn)) {
if (te(`${key}.${title}`) && t(`${key}.${title}`)) {
Expand All @@ -34,3 +36,8 @@ export const langTitle = (title) => {
}
return title
}

//get i18n instance
export const getLangInstance = () => {
return i18n.global as ObjKeys
}
2 changes: 1 addition & 1 deletion src/hooks/use-permission.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import NProgress from 'nprogress'
import type { RouteRawConfig, RouterTypes, rawConfig } from '~/basic'
import type { RouteRecordName } from 'vue-router'
/**
Expand All @@ -6,7 +7,6 @@ import type { RouteRecordName } from 'vue-router'
* return 过滤后的异步路由
*/
// @ts-ignore
import NProgress from 'nprogress'
import Layout from '@/layout/index.vue'
/*
* 路由操作
Expand Down
5 changes: 4 additions & 1 deletion src/hooks/use-self-router.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import router from '@/router'

export const getQueryParam = () => {
const route: any = router.currentRoute
if (route.value?.query.params) {
Expand Down Expand Up @@ -35,6 +34,10 @@ export const routerReplace = (name, params) => {
query: data
})
}

export const routeInfo = () => {
return router.currentRoute
}
export const routerBack = () => {
router.go(-1)
}
1 change: 1 addition & 0 deletions src/icons/common/chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/icons/common/clipboard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/icons/common/component.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/icons/common/dashboard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/icons/common/demo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/icons/common/documentation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/icons/common/drag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/icons/common/edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/icons/common/education.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/icons/common/email.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/icons/common/example.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3a9330e

Please sign in to comment.