vue.js开发老出现这个错误 el is not defined
本文介绍了vue.js开发老出现这个错误 el is not defined的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
遇到的问题的:评论页面comment.vue引入了一个组件reply.vue,在reply.vue引入了alert弹框组alert.vue,老出现这个错误 el is not defined。
reply.vue代码如下
新手求指教
解决方案
你只有引用 Alert
,卻沒把他加入父組件的 Components
裡面
import Alert from './nvAlert.vue'
export default {
replace: true,
props: ['topic', 'topicId'],
components: { Alert } // ES6
// components: { 'alert' : Alert } // ES5
}
補充
另外 Vue 的組件名稱大小寫無關,詳情可以看這 资源命名约定
这篇关于vue.js开发老出现这个错误 el is not defined的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文