sethsandaru / vue-form-builder

Super Form Builder built on top of Vue with Drag & Drop functionality, savable-form-schema and easy to maintain/upgrade your form.
http://vue-form-builder.sethphat.com
MIT License
413 stars 129 forks source link

Browser Usage #127

Closed KhaledOmara closed 2 years ago

KhaledOmara commented 2 years ago

I've downloaded the files from dist folder, then added them in the browser.

I'm facing the error: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option. Here is my HTML:

<div id="formBuilderApp" class="formBuilderPageWrap notvisibile" v-bind:class="{visibile : isLoaded}">
    <formbuilder v-model="formConfigurations"></formbuilder>
</div>

Here is my JS:


Vue.use(VueFormBuilderPlugin, {
      globalInjection: true,
});
new Vue({ 
        el: '#formBuilderApp', 
        data: {
            isLoaded: false,
            permissions: {},
            formConfigurations: {},
        },
        created: function () {
            this.isLoaded = true;
        },
        watch: {
            isLoaded: function (val) {},
        },
        methods: {},
    });
</script>```
KhaledOmara commented 2 years ago

@sethsandaru

KhaledOmara commented 2 years ago

I figured it out. The issue was in the component name in the template change FormBuilder to form-builder

<div id="formBuilderApp" class="formBuilderPageWrap notvisibile" v-bind:class="{visibile : isLoaded}">
    <form-builder v-model="formConfigurations"></form-builder>
</div>
Vue.use(VueFormBuilderPlugin, {
      globalInjection: true,
});
new Vue({ 
        el: '#formBuilderApp', 
        data: {
            isLoaded: false,
            formConfigurations: null,
        },
        created: function () {
            this.isLoaded = true;
        },
        watch: {
            isLoaded: function (val) {},
        },
        methods: {},
    });
</script>