Skip to content

Commit 76dc9c2

Browse files
committed
migration(*): refactored sidebar logic to support unlimited menus
1 parent 43e3e97 commit 76dc9c2

34 files changed

+498
-573
lines changed

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,18 @@
1818
"@tinymce/tinymce-vue": "^2.0.0",
1919
"@vue/composition-api": "^0.5.0",
2020
"axios": "~0.18.0",
21-
"element-plus": "^1.0.1-alpha.14",
21+
"core-js": "^3.6.5",
22+
"element-plus": "^1.0.1-alpha.21",
2223
"event-source-polyfill": "^1.0.7",
2324
"fastscan": "^1.0.4",
2425
"good-storage": "^1.1.0",
2526
"js-cookie": "^2.2.0",
2627
"lodash": "^4.17.14",
28+
"mitt": "^2.1.0",
2729
"moment": "^2.24.0",
2830
"photoswipe": "^4.1.2",
2931
"screenfull": "^4.2.0",
3032
"tinymce": "^5.0.1",
31-
"core-js": "^3.6.5",
3233
"vue": "^3.0.0",
3334
"vue-awesome-swiper": "^3.1.3",
3435
"vue-croppa": "^1.3.8",

public/iconfont.css

+26-6
Large diffs are not rendered by default.

src/component/base/preview/preview.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<script>
4242
// photoswipe接口文档 http://photoswipe.com/documentation/api.html
4343
44-
import { Loading } from 'element-plus'
44+
import { ElLoading } from 'element-plus'
4545
import 'photoswipe/dist/photoswipe.css'
4646
import 'photoswipe/dist/default-skin/default-skin.css'
4747
import PhotoSwipe from 'photoswipe/dist/photoswipe'
@@ -114,7 +114,7 @@ export default {
114114
options = Object.assign(defaultOptions, options, {
115115
index: imageIndex,
116116
})
117-
const loadingInstance = Loading.service()
117+
const loadingInstance = ElLoading.service()
118118
const galleryElement = this.$refs.myGallery
119119
this.radom = createId()
120120
let pswpElement = this.$refs.pswpWrap

src/component/layout/clear-tab.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
</template>
44

55
<script>
6+
import emitter from 'lin/util/emitter'
7+
68
export default {
79
name: 'CloseTab',
8-
inject: ['eventBus'],
910
methods: {
1011
closeReuseTab() {
11-
this.eventBus.$emit('clearTap')
12+
emitter.emit('clearTap')
1213
},
1314
},
1415
}

src/component/layout/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import NavBar from './nav-bar'
2-
import SideBar from './side-bar'
2+
import Sidebar from './sidebar/sidebar.vue'
33
import AppMain from './app-main'
44
import ReuseTab from './reuse-tab'
55
import MenuTab from './menu-tab.vue'
66
import BackTop from './back-top.vue'
77
import User from './user.vue'
88

9-
export { NavBar, SideBar, AppMain, ReuseTab, MenuTab, BackTop, User }
9+
export { NavBar, Sidebar, AppMain, ReuseTab, MenuTab, BackTop, User }

src/component/layout/reuse-tab.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
<script>
2929
import { mapGetters } from 'vuex'
30+
import emitter from 'lin/util/emitter'
3031
import { swiper, swiperSlide } from 'vue-awesome-swiper'
3132
3233
import 'swiper/dist/css/swiper.css' // eslint-disable-line
@@ -88,13 +89,12 @@ export default {
8889
},
8990
histories(arr) {
9091
if (arr.length < 2) {
91-
this.eventBus.$emit('noReuse')
92+
emitter.emit('noReuse')
9293
} else {
93-
this.eventBus.$emit('hasReuse')
94+
emitter.emit('hasReuse')
9495
}
9596
},
9697
},
97-
inject: ['eventBus'],
9898
created() {
9999
// 关闭窗口时执行
100100
window.onbeforeunload = () => {
@@ -113,7 +113,7 @@ export default {
113113
},
114114
mounted() {
115115
this.init()
116-
this.eventBus.$on('clearTap', () => {
116+
emitter.on('clearTap', () => {
117117
this.histories = []
118118
})
119119
},

0 commit comments

Comments
 (0)