吨~ 2019-11-20 15:02 采纳率: 0%
浏览 2306

IE11浏览器报语法错误

错误定位在main.js

图片说明

# main.js代码如下

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import "babel-polyfill"
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui'
import store from './store'
import Config from './config/'
import Api from './api/'
import Common from './utils/common'
import PageAtion from '../src/components/PageAtion' // 自定义封装的分页组件
import CKEditor from '@ckeditor/ckeditor5-vue'

// 自定义指令
import has from './utils/directive/has'

// 引入全局样式
import '../static/css/index.css'
import '../static/css/common.css'
import '../static/css/style.css'
import '../static/css/font-awesome.all.css'
import 'tinymce/skins/ui/oxide/skin.css'
// svgIcon
import './icons'

// 国际化语言设置(语言切换)
import i18n from './lang'

// 挂载全局变量
Vue.prototype.$Config = Config;
Vue.prototype.$Api = Api; // 全局API
Vue.prototype.$Common = Common; // 自定义函数
// Vue.prototype.$ReqUrl = ReqUrl // 自定义函数

// 注册全局组件
Vue.component('pageAtion', PageAtion); // 分页组件

Vue.use(ElementUI);
Vue.use(has);
Vue.use({
    i18n: (key, value) => i18n.t(key, value)
});
Vue.use(CKEditor);

// 登录状态判断 (路由拦截)
router.beforeEach((to, from, next) => {
    let userName = sessionStorage.getItem('user')
    if (!userName) {
        //未登录
        sessionStorage.clear()
        if (to.path === '/login' || to.path === '/') {
            next()
        } else {
            next('/login')
        }
    } else {
        Api.getUserInfo().then(res => {
            // if (res) {
            if (res.data.result) {
                // 有 session 信息
                let loginName = res.data.result.loginName
                    // 新用户登录
                if (userName != loginName) {
                    store.dispatch('GetUserInfo')
                        .then(res => {
                            if (res.data.result) {
                                next()
                            } else {
                                next('/login')
                            }
                        })
                        .catch(error => {
                            next('/login')
                        })
                } else {
                    if (to.path == '/layout') {
                        next()
                    } else {
                        if (to.path == '/login' || to.path == '/') {
                            next('/layout')
                        } else {
                            next()
                        }
                    }
                }
            } else {
                // session 过期
                sessionStorage.clear()
                if (to.path == '/login' || to.path == '/') {
                    next()
                } else {
                    next('/login')
                }
            }
            // } else {
            //     sessionStorage.clear()
            //     if (to.path == '/login' || to.path == '/') {
            //         next()
            //     } else {
            //         next('/login')
            //     }
            // }
        })
    }
})

// 用户手动刷新页面 重新获取本地存储的用户信息
if (sessionStorage.getItem('userinfo')) {
    let token = sessionStorage.getItem('token')
    let userName = sessionStorage.getItem('user')
    store.commit('SET_TOKEN', token)
    store.commit('SET_LOGINNAME', userName)

    // 用户信息
    let userinfo = JSON.parse(sessionStorage.getItem('userinfo'))
    store.commit('SET_USERINFO', userinfo)

    // 统计信息
    let statisMap = JSON.parse(sessionStorage.getItem('statisMap'))
    store.commit('SET_STATISMAP', statisMap)
}

Vue.config.productionTip = false;

/* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    i18n,
    store,
    components: {
        App
    },
    // template: '<App/>'
    render: h => h(App)
})
  • 写回答

1条回答

  • 宋哈哈 2023-04-20 23:41
    关注

    还用ie呢 干的啥活儿 赶紧撩

    评论

报告相同问题?

悬赏问题

  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥50 汇编语言除法溢出问题
  • ¥65 C++实现删除N个数据列表共有的元素
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波