diff --git a/admin/package.json b/admin/package.json index 7c9fee3..a333af2 100644 --- a/admin/package.json +++ b/admin/package.json @@ -13,7 +13,8 @@ "build": "node build/build.js" }, "dependencies": { - "babel-polyfill": "^6.26.0" + "babel-polyfill": "^6.26.0", + "mavon-editor": "^2.9.0" }, "devDependencies": { "autoprefixer": "^7.1.2", diff --git a/admin/src/App.vue b/admin/src/App.vue index 446d6a0..3970e8d 100644 --- a/admin/src/App.vue +++ b/admin/src/App.vue @@ -18,7 +18,7 @@
+ placeholder="请输入要搜索的内容" @keyup.enter.native="searchInputHandle">
@@ -267,7 +267,7 @@ //设定框宽度 this.searchInputStyle.width = window.innerWidth - 200 - 10 + 'px'; //判断是否显示菜单栏 - this.elAsideShow = window.innerWidth > 1366 ? true : false; + this.elAsideShow = window.innerWidth > glob.minWidth ? true : false; }, //log点击事件 mainLogoBtnClick() { @@ -298,6 +298,10 @@ if (this.leftMenuDrawerShow) { this.leftMenuDrawerShow = false; } + }, + //搜索框输入 + searchInputHandle() { + this.$EventBus.$emit(glob.eventNames.globSearchEventName, this.searchInputText); } } } diff --git a/admin/src/assets/js/glob.js b/admin/src/assets/js/glob.js index e1d5e27..fcc2eeb 100644 --- a/admin/src/assets/js/glob.js +++ b/admin/src/assets/js/glob.js @@ -2,6 +2,13 @@ import router from "../../router"; import {Message} from 'element-ui'; const glob = { + //最小宽度 + minWidth: 1366, + //事件名称 + eventNames: { + //全局搜索事件名称 + globSearchEventName: 'globSearch', + }, //初始化 inti() { //初始化NProgress diff --git a/admin/src/components/artice/add.vue b/admin/src/components/artice/add.vue new file mode 100644 index 0000000..2a225b2 --- /dev/null +++ b/admin/src/components/artice/add.vue @@ -0,0 +1,120 @@ + + + + + diff --git a/admin/src/components/artice/main.vue b/admin/src/components/artice/main.vue new file mode 100644 index 0000000..a2bd64e --- /dev/null +++ b/admin/src/components/artice/main.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/admin/src/components/article.vue b/admin/src/components/article.vue deleted file mode 100644 index 46afd3d..0000000 --- a/admin/src/components/article.vue +++ /dev/null @@ -1,49 +0,0 @@ - - - - - diff --git a/admin/src/components/leftMenu.vue b/admin/src/components/leftMenu.vue index d2e853a..f1c784d 100644 --- a/admin/src/components/leftMenu.vue +++ b/admin/src/components/leftMenu.vue @@ -5,7 +5,7 @@ 首页 - + 文章 diff --git a/admin/src/main.js b/admin/src/main.js index 1d88d9a..3209422 100644 --- a/admin/src/main.js +++ b/admin/src/main.js @@ -5,9 +5,15 @@ import router from './router/index' import "babel-polyfill"; import './assets/scss/glob.scss'; import glob from './assets/js/glob.js'; +import mavonEditor from 'mavon-editor' +import 'mavon-editor/dist/css/index.css' //use Vue.config.productionTip = false; +//EventBus +Vue.prototype.$EventBus = new Vue(); +//mavonEditor +Vue.use(mavonEditor); //init glob.inti(); /* eslint-disable no-new */ diff --git a/admin/src/router/index.js b/admin/src/router/index.js index 2281cc8..3392c80 100644 --- a/admin/src/router/index.js +++ b/admin/src/router/index.js @@ -9,8 +9,13 @@ export default new VueRouter({ }, { path: '/article', - name: 'article', - component: () => import('../components/article'), + name: 'article-main', + component: () => import('../components/artice/main'), + }, + { + path: '/article/add', + name: 'article-add', + component: () => import('../components/artice/add'), } ] });