Vue 使用 httpVueLoader 加载vue组件 vue页面使用 module.exports


index.html


"en">

    "UTF-8">
    游戏资源管理系统
    "stylesheet" href="{$__TMPL__}/home/index/static/css/element_ui_index.css">
    "stylesheet" href="{$__TMPL__}/home/index/static/css/iconfont.css">
    "stylesheet" href="{$__TMPL__}/home/index/static/css/common.css">

    
    

    
    
    


"app" v-cloak> if="isLogin">
class="left"> "{$__TMPL__}/home/index/static/images/logo.png" class="logo">
class="right"> "handleCommand">

class="el-dropdown-link"> "{$__TMPL__}/home/index/static/images/header.png" class="head_img"> 你好,{{userInfo.username}} class="iconfont icon-xiala">

"dropdown"> "login">退出登录
"140px"> default-active="1-4-1" class="el-menu-vertical-demo" :collapse="hideSider"> "changeMain(item.tag)" :class="{'is-active':currentComponent == item.tag}" v-for="(item ,index) in menuList" :key="index"> class="iconfont" :class="item.icon"> "title">{{item.name}}
class="breadcrumb"> "/"> "{ path: '/' }">首页 for="(item ,index) in menuList" :key="index" v-show="currentComponent == item.tag"> {{item.name}}
is="currentComponent">
else> is="currentComponent">

index.js

// 使用httpVueLoader
new Vue({
    el: '#app',
    data() {
        return {
            visible: false,
            hideSider: false,
            currentComponent: "Login",
            menuList: [
                {
                    name: "文件上传",
                    tag: "FileUpload",
                    icon: "icon-upload_file"
                },
                {
                    name: "文件分类",
                    tag: "DocumentClassification",
                    icon: "icon-files"
                },
                {
                    name: "资源管理",
                    tag: "ResourceManager",
                    icon: "icon-resource"
                },
                {
                    name: "注册审核",
                    tag: "RegisterReview",
                    icon: "icon-regist"
                }

            ],
            userInfo: {
                username: "张三"
            },
            isLogin: false,
        }
    },
    components: {
        'FileUpload': httpVueLoader('/template/default/pc/home/index/views/fileUpload.vue'),
        'DocumentClassification': httpVueLoader('/template/default/pc/home/index/views/documentClassification.vue'),
        'Login': httpVueLoader('/template/default/pc/home/index/views/login.vue'),
        'RegisterReview': httpVueLoader('/template/default/pc/home/index/views/registerReview.vue'),
        'ResourceManager': httpVueLoader('/template/default/pc/home/index/views/resourceManager.vue')
    },
    created() {
        let _this = this;
        _this.userInfo = getSessionStorage('userInfo');
        console.log('userInfo', _this.userInfo);
        if (!_this.userInfo) {
            _this.isLogin = false;
            _this.currentComponent = "Login";
        } else {
            console.log("已登录");
            _this.isLogin = true;
            _this.currentComponent = "FileUpload";
        }
    },
    mounted() {
        console.log("登录状态", this.isLogin);

    },
    watch: {
        isLogin: function (val) {
            let _this = this;
            _this.isLogin = val;
        }
    },
    methods: {
        changeMain(obj) {
            let _this = this;
            _this.currentComponent = obj;
        },
        handleCommand(command) {
            let _this = this;
            this.$confirm('退出登录, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                setSessionStorage('userInfo', '');
                _this.isLogin = false;
                _this.currentComponent = "Login";
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消退出'
                });
            });

        }
    }
})

login.vue





本地访问没问题,但是发布到线上服务器时 火狐浏览器一直报错如下所示:并且没有找到解决办法

 IE也不支持

 若是有同行知道解决办法还请告知下哦,感激不尽