| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import Vue from 'vue'
- import App from './App.vue'
- import router from './router'
- import store from './store'
- import ElementUI from 'element-ui'
- import 'element-ui/lib/theme-chalk/index.css'
- import { formatPrice, formatPriceWithSymbol, formatRate, formatScore } from './utils/format'
- Vue.use(ElementUI)
- Vue.prototype.formatPrice = formatPrice
- Vue.prototype.formatPriceWithSymbol = formatPriceWithSymbol
- Vue.prototype.formatRate = formatRate
- Vue.prototype.formatScore = formatScore
- // Fix Element UI 2.15.x el-submenu removeTabindex null error
- // https://github.com/ElemeFE/element/issues/21965
- // Also fixes: v-if 切换菜单项后 el-submenu 残留 DOM 遮罩导致无法点击的问题
- const ElSubmenu = Vue.component('ElSubmenu')
- if (ElSubmenu && ElSubmenu.options && ElSubmenu.options.methods) {
- const origRemove = ElSubmenu.options.methods.removeTabindex
- if (origRemove) {
- ElSubmenu.options.methods.removeTabindex = function() {
- try {
- if (!this.$el || !this.$el.querySelector) return
- const tooltip = this.$el.querySelector('.el-tooltip')
- if (!tooltip) return
- return origRemove.call(this)
- } catch (e) {
- // v-if 切换导致 DOM 已销毁时的静默容错
- }
- }
- }
- // el-submenu 展开/收起时也可能操作已销毁的 DOM
- const origOpen = ElSubmenu.options.methods.open
- if (origOpen) {
- ElSubmenu.options.methods.open = function() {
- try {
- return origOpen.call(this)
- } catch (e) {
- // 静默容错
- }
- }
- }
- }
- Vue.config.productionTip = false
- new Vue({
- router,
- store,
- render: h => h(App)
- }).$mount('#app')
|