解决vue报错Failed to mount componentg或者template or render function not defined

解决vue报错Failed to mount component

废话不多说,放图:
在这里插入图片描述


我本次开发项目结构:
在这里插入图片描述
因为怕vue文件里面的代码过多,所以把css、js文件都单独写在一个文件里面

<template>
    <div class="senior-certification-com">...</div>
</template>

<script>
    import questionLabel from "./questionLabel";
	export default questionLabel;
</script>

<style lang="stylus" scoped>
    @import url("./questionLabel.less");
</style>

router.js(路由)

{       
        path: '/question/questionLabel',
        component: () => import('@/myviews/question/questionLabel/questionLabel'),
        name: '问答标签',
        meta: {
          title: '问答标签',
        }
      }

这些代码看起来都是没问题,但是页面就是展示不出来

经过排查,发现这段代码才是元凶

component: () => import('@/myviews/question/questionLabel/questionLabel'),

解决方法:

component: () => import('@/myviews/question/questionLabel/questionLabel.vue'),

原因:没找到相对应的".vue"文件,按照查找规则,上面的代码是直接找到“.js”文件,所以报错

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值