【问题标题】:How to solve Vue-Formulate Failed to resolve component errorVue-Formulate Failed to resolve component 错误如何解决
【发布时间】:2021-02-27 01:26:58
【问题描述】:

我对 Vue 有点陌生,而且我越来越难以破解它。我正在使用 Vue 3 我想使用 Vue-Formulate 在我的 vue 应用程序上创建一个注册表单。以下是我在 Vue-Formulate 官方文档之后的进展:

// main.js

import { createApp } from 'vue'
import App from './App.vue'

import VueFormulate from '@braid/vue-formulate'

createApp(App).use(VueFormulate).mount('#app')

然后在 Register.vue 上:

<template>
  <formulate-form v-model="formValues" @submit="registerUser">
     <formulate-input name="first_name" label="First Name" placeholder="First Name" type="text"></formulate-input>
  </formulate>
</template>

<script>
export default {
    name: 'RegisterLogin',
    methods: {
        registerUser () {
            // call back here
        }
    }
}
</script>

但我得到 [Vue warn]: Failed to resolve component: formula-form[Vue warn]: Failed to resolve component: Formula-input 错误控制台和表单拒绝呈现。我真的说不出为什么。来自这里的答案:[Vue warn]: Failed to resolve component: Step1Item: 也没有帮助。

【问题讨论】:

    标签: javascript vue.js vuejs3


    【解决方案1】:

    在 Register.vue 中导入您正在使用的所有组件:

    import { FormulateForm, FormulateInput } from '@braid/vue-formulate';
    

    然后在导出方法中尝试添加组件对象并列出您正在使用的所有组件的名称,如下所示:

    export default {
       components: {
         FormulateForm,
         FormulateInput,
         another-component-here
       },
       * the rest of the code here *
    }
    

    【讨论】:

      【解决方案2】:

      好吧,我不得不创建自己的表单组件,因为我无法解决这个问题。

      【讨论】:

        猜你喜欢
        • 2020-06-12
        • 2021-01-22
        • 2016-08-28
        • 2022-11-20
        • 1970-01-01
        • 1970-01-01
        • 2021-08-05
        • 1970-01-01
        • 2022-07-14
        相关资源
        最近更新 更多