百度了好多結(jié)果,都過時(shí)了,例如:
模塊引入是否加{}
再比如:
對于遞歸組件,請確保提供“name”選項(xiàng)。
出現(xiàn)該錯(cuò)誤情況之一:
錯(cuò)誤由未正確引入組件或子組件引起,如element-ui中form表單組件未引用el-form-item子組件就會出現(xiàn)這個(gè)錯(cuò)誤。
<el-form >
????? <el-form-item >
??????? <el-input></el-input>
????? </el-form-item>
??? </el-form>
// 局部引入element-ui組件?? ?
import { Input, Button, Form, FormItem } from "element-ui";
export default {
? name:"updatePwd",
? components: {
??? "el-input": Input,
??? "el-button": Button,
??? "el-form": Form,
?? // "el-form-item": FormItem,? // 當(dāng)不引用該組件而使用時(shí)就會報(bào)錯(cuò)
? },
再比如:
是否在components引用定義的組件
components拼寫是否正確,是components不是component,注意要加s
引用組件name屬性是否和文件名一致
import name form ‘XXXXX’ name名是否和components內(nèi)引用名一致
引用組件位置是否在<template></template>或<template><div></div></template>內(nèi)部
?
還有說是組件名稱大小寫的問題。
在新版vue里,這些都不太對。直接在script setup里引入就解決了:
<script setup>
import component1 from './component1.vue'文章來源:http://www.zghlxwxcb.cn/news/detail-783545.html
<script>文章來源地址http://www.zghlxwxcb.cn/news/detail-783545.html
到了這里,關(guān)于vue 組件 import make sure to provide the “name“ option.的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!