Skip to content

Commit 032e3eb

Browse files
committed
feat(*): to vue next
1 parent c2c9923 commit 032e3eb

8 files changed

Lines changed: 3153 additions & 2566 deletions

File tree

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
jest: true,
88
},
99
plugins: ['vue'],
10-
extends: ['plugin:vue/essential', '@vue/airbnb'],
10+
extends: ['plugin:vue/vue3-essential', '@vue/airbnb'],
1111
rules: {
1212
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
1313
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',

package-lock.json

Lines changed: 559 additions & 64 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"name": "lin-cms",
3-
"version": "0.3.5",
4-
"private": true,
2+
"name": "lin-cms-vue",
3+
"version": "0.4.0",
4+
"license": "MIT",
55
"scripts": {
66
"serve": "node script/plugin-get-config.js && vue-cli-service serve",
77
"build": "node script/plugin-get-config.js && vue-cli-service build",
8+
"test:unit": "vue-cli-service test:unit",
89
"lint": "vue-cli-service lint",
910
"commit": "git-cz",
1011
"plugin:init": "node script/plugin-init.js",
1112
"plugin:new": "node script/plugin-new.js",
12-
"plugin:reconfig": "node script/plugin-get-config.js",
13-
"test:unit": "vue-cli-service test:unit"
13+
"plugin:reconfig": "node script/plugin-get-config.js"
1414
},
1515
"dependencies": {
1616
"@antv/g2plot": "^0.11.35",
@@ -28,20 +28,21 @@
2828
"photoswipe": "^4.1.2",
2929
"screenfull": "^4.2.0",
3030
"tinymce": "^5.0.1",
31-
"vue": "^2.6.10",
31+
"vue": "^3.0.0-beta.1",
3232
"vue-awesome-swiper": "^3.1.3",
3333
"vue-croppa": "^1.3.8",
34-
"vue-router": "^3.0.7",
35-
"vuex": "^3.1.1",
34+
"vue-router": "^4.0.0-alpha.5",
35+
"vuex": "^4.0.0-alpha.1",
3636
"vuex-persist": "^2.0.1"
3737
},
3838
"devDependencies": {
39-
"@vue/cli-plugin-babel": "^3.9.2",
40-
"@vue/cli-plugin-eslint": "^3.9.2",
41-
"@vue/cli-plugin-unit-jest": "^3.9.0",
42-
"@vue/cli-service": "^3.9.2",
39+
"@vue/cli-plugin-babel": "^4.3.1",
40+
"@vue/cli-plugin-eslint": "^4.3.1",
41+
"@vue/cli-plugin-unit-jest": "^4.3.1",
42+
"@vue/cli-service": "^4.3.1",
43+
"@vue/compiler-sfc": "^3.0.0-beta.1",
4344
"@vue/eslint-config-airbnb": "^4.0.1",
44-
"@vue/test-utils": "1.0.0-beta.29",
45+
"@vue/test-utils": "^2.0.0-alpha.1",
4546
"babel-core": "7.0.0-bridge.0",
4647
"babel-eslint": "^10.0.2",
4748
"babel-jest": "^24.8.0",
@@ -52,7 +53,7 @@
5253
"directory-tree": "^2.2.3",
5354
"ejs": "^2.6.2",
5455
"eslint": "^6.0.1",
55-
"eslint-plugin-vue": "^5.2.3",
56+
"eslint-plugin-vue": "^7.0.0-alpha.0",
5657
"fs-extra": "^8.1.0",
5758
"inquirer": "^6.5.0",
5859
"js-yaml": "^3.13.1",
@@ -62,8 +63,8 @@
6263
"semver": "^6.2.0",
6364
"shelljs": "^0.8.3",
6465
"validate-npm-package-name": "^3.0.0",
66+
"vue-cli-plugin-vue-next": "~0.1.3",
6567
"vue-markdown-loader": "^2.4.1",
66-
"vue-template-compiler": "^2.6.10",
6768
"yaml-front-matter": "^4.0.0"
6869
},
6970
"postcss": {

src/component/layout/side-bar.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@
3737
:index="idMap[item.name]"
3838
popper-class="abc"
3939
>
40-
<template slot="title">
41-
<i v-if="!filterIcon(item.icon)" :class="item.icon"></i> <img v-else :src="item.icon" class="imgIcon" />
42-
<span slot="title">{{ item.title }}</span>
40+
<template v-slot:title>
41+
<i v-if="!filterIcon(item.icon)" :class="item.icon"></i>
42+
<img v-else :src="item.icon" class="imgIcon" />
43+
<span>{{ item.title }}</span>
4344
</template>
4445

4546
<!-- 二级菜单 -->
@@ -50,9 +51,9 @@
5051
:index="idMap[subItem.name]"
5152
class="subMenuContent"
5253
>
53-
<template slot="title">
54+
<template v-slot:title>
5455
<i class="iconfont icon-erjizhibiao"></i>
55-
<span slot="title" class="two-folder">{{ subItem.title }}</span>
56+
<span class="two-folder">{{ subItem.title }}</span>
5657
</template>
5758

5859
<!-- 三级菜单 -->
@@ -84,8 +85,9 @@
8485
v-else
8586
:key="idMap[item.name]"
8687
>
87-
<i v-if="!filterIcon(item.icon)" :class="item.icon"></i> <img v-else :src="item.icon" class="imgIcon" />
88-
<span slot="title">{{ item.title }}</span>
88+
<i v-if="!filterIcon(item.icon)" :class="item.icon"></i>
89+
<img v-else :src="item.icon" class="imgIcon" />
90+
<span>{{ item.title }}</span>
8991
</el-menu-item>
9092
</template>
9193
</el-menu>

src/main.js

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import '@babel/polyfill'
2-
import Vue from 'vue'
1+
import Vue, { createApp } from 'vue'
32
import VueCompositionApi from '@vue/composition-api'
43
import ElementUI from 'element-ui'
54

@@ -23,16 +22,6 @@ import '@/assets/style/index.scss' // eslint-disable-line
2322
import '@/assets/style/realize/element-variable.scss'
2423
import 'element-ui/lib/theme-chalk/display.css'
2524

26-
Vue.config.productionTip = false
27-
28-
Vue.use(ElementUI)
29-
Vue.use(VueCompositionApi)
30-
Vue.use(LinNotify, {
31-
reconnection: true,
32-
reconnectionAttempts: 5,
33-
reconnectionDelay: 3000,
34-
})
35-
3625
Vue.component(CollapseTransition.name, CollapseTransition)
3726

3827
// base 组件注册
@@ -41,11 +30,10 @@ Vue.component('l-icon', LIcon)
4130
Vue.component('source-code', SourceCode)
4231

4332
/* eslint no-unused-vars: 0 */
44-
const AppInstance = new Vue({
45-
router,
46-
store,
47-
render: h => h(App),
48-
}).$mount('#app')
33+
const AppInstance = createApp(App)
34+
.use(router)
35+
.use(store)
36+
.mount('#app')
4937

5038
// 设置 App 实例
5139
window.App = AppInstance

src/router/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import Vue from 'vue'
2-
import Router from 'vue-router'
2+
import { createRouter } from 'vue-router'
33
import routes from './route'
44
import store from '../store'
55
import appConfig from '@/config/index'
66
import Util from '@/lin/util/util'
77

8-
Vue.use(Router)
9-
108
// 判断是否需要登录访问, 配置位于 config 文件夹
119
let isLoginRequired = routeName => {
1210
// 首次执行时缓存配置
@@ -35,8 +33,7 @@ let isLoginRequired = routeName => {
3533
return isLoginRequired(routeName)
3634
}
3735

38-
const router = new Router({
39-
// mode: 'history',
36+
const router = createRouter({
4037
scrollBehavior: () => ({
4138
y: 0,
4239
}),

src/store/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Vue from 'vue'
21
import Vuex from 'vuex'
32
import createLogger from 'vuex/dist/logger'
43
import VuexPersistence from 'vuex-persist'
@@ -7,8 +6,6 @@ import state from './state'
76
import * as getters from './getter'
87
import actions from './action'
98

10-
Vue.use(Vuex)
11-
129
const vuexLocal = new VuexPersistence({
1310
storage: window.localStorage,
1411
reducer: stateData => ({
@@ -21,7 +18,7 @@ const vuexLocal = new VuexPersistence({
2118

2219
const debug = process.env.NODE_ENV !== 'production'
2320

24-
export default new Vuex.Store({
21+
export default Vuex.createStore({
2522
state,
2623
getters,
2724
mutations,

0 commit comments

Comments
 (0)