Unknown Custom Element: - Did You Register The Component Correctly?
Pisarev pro asked 4 years ago
Try to use input componennt in contact section (come across simple case beneath). Only fet an fault: [Vue warn]: Unknown custom element: <mdb-input> - did you lot register the component correctly? For recursive components, make sure to provide the "name" option.
<template> <div> <container> <section id="contact" form="lighten-v my-5"> <h2 class="h1-responsive font-weight-bold text-center my-5">Напишите нам</h2> <row> <column md="9" class="medico-0 mb-5"> <row> <column md="6"> <!-- <div grade="doc-form mb-0"> --> <mdb-input type="text" id="form-contact-name" label="Your proper name"/> <!-- </div> --> </column> <column md="6"> <mdb-input type="text" id="grade-contact-e-mail" label="Your email" /> </column> </row> <row> <column medico="12"> <mdb-input blazon="text" id="grade-contact-phone" label="Your phone" /> </cavalcade> </row> <div class="text-center text-md-left"> <btn color="principal" size="md">Send</btn> </div> </column> <cavalcade md="3" course="text-eye"> <ul class="list-unstyled mb-0"> <li> <fa icon="map-marker" size="2x" class="blue-text"/> <p>San Francisco, CA 94126, USA</p> </li> <li> <fa icon="telephone" size="2x" form="blue-text mt-4"/> <p>+ 01 234 567 89</p> </li> <li> <fa icon="envelope" size="2x" form="blueish-text mt-4"/> <p>contact@example.com</p> </li> </ul> </column> </row> </section> </container> </div> </template> <script> import { Container, Row, Column, Avatar, Btn, Fa, mdbInput, MdTextarea, Card, CardBody } from "mdbvue"; consign default { components: { Container, Row, Column, Avatar, Btn, mdbInput, MdTextarea, Card, CardBody, Fa }, }; </script> <way scoped> </style>
Jakub Strebeyko staff answered 4 years ago
Hi, This is unusual, seems like y'all're doing a good "annals the component" task done - copying and pasting your lawmaking into a webpack served project works fine, besides. Can you try to update MDB Vue packet? Best, Kuba
Pisarev pro answered 4 years ago
I take the latest MDB Vue Pro version (four.viii.i)
Jakub Strebeyko staff answered four years ago
Is mdbInput the only component causing issues in these instance?
Pisarev pro answered 4 years ago
Yes! Merely I have also tried "mdbSelect". It has the same error. Other components works correctly.
Jakub Strebeyko staff answered 4 years ago
Hi, Super weird! How nigh this - tell me how do y'all install mdbvue (is it equally an outside gitlab dependency, or are y'all creating new project using starter kit .nix), and I shall follow your steps and use your lawmaking, and so we can see exactly what went wrong. Does this sound OK with you? Best, Kuba
Pisarev pro answered 4 years ago
My steps:
-
Add together dependencies : {"mdbvue":"git+https://oauth2:<TOKEN_HERE>@git.mdbootstrap.com/mdb/vue/vu-pro.git"}
- in app.js I put the following code:
import Vue from 'vue'; import 'bootstrap-css-only/css/bootstrap.min.css'; import 'mdbvue/build/css/mdb.css'; import router from 'mdbvue/src/router';
import AppExample from 'mdbvue/src/App.vue'; import AlertPlug from 'mdbvue/src/components/pro/AlertPlug.js'; Vue.use(AlertPlug);
const app = new Vue({ el: '#app', router, shop, template: '<AppExample/>', components: { AppExample } });
And I get an error: https://cloud.mail service.ru/public/7jwM/WFpAV2cmT
Jakub Strebeyko staff answered iv years ago
Howdy at that place, Thank you for posting these! Tried to follow them as closely as I could with available info: one. I used vue-cli 3
to scaffold a Vue projection; 2. Imported mdbvue
equally a dependency (Important: refrain from posting your token here, this one is for your eyes only) 3. Inverse the chief.js
every bit described, merely: a) had to omit the `shop` option in root Vue instance, as it is non imported; b) had to add runtimeCompiler: true
option to vue.config.js
, since the cli
is by default a runtime-but and the stringtemplate
is used. Both the forms/inputs
page, as well as the snippet from the first post, worked. Do you think I followed the instruction shut plenty? I believe at that place might something most the project you are importing it to that I practise not know about and what is making mdbInput
bear all funny. Let me know what you think. With All-time Regards, Kuba
Pisarev pro answered iv years ago
Hello,Kuba, I have made the aforementioned steps but nothing working. The reason is that I use Laravel with prebuilt webpack config (it calls 'laravel mix'). if I exercise a 'fresh' instalation of MDB Vue with webpack specific config as a new project so I wouldn't accept such an fault. It means that config somehow is dissimilar in Laravel and MDB Vue Pro bundle. I have made 'fresh' Laravel install and import MDB Vue Pro and have the same error. Did you attempt to setup MDB Vue Pro in Laravel? Tin I share the files and you can check? Kind regards, Andrey
Pisarev pro answered iv years ago
I have constitute the decision but information technology is not the best option. I have made changes in the original cod in core MDB Vue Pro libarary. The reason of an mistake is a recursive tree problem in MDB's components. May be a correct webpack config heals the problem during compiling I don't know merely what I have done to fix the trouble: one. mdbbue/src/index.js
// import Input, { mdbInput } from './components/Input';
import mdbInput from './components/Input'; //import only mdbInput so as I don't need Input and it eliminates a recursive tree problem
two. mdbbue/src/components/Input.vue
//const Input = {
const mdbInput = {
props: {
basic: {
blazon: Boolean,
default: false
},....
// export default Input;
// export { Input as mdbInput };
consign default mdbInput; //import only mdbInput so as I don't need Input and it eliminates a recursive tree trouble
Anyway I hope MDB tech squad will aid to properly install MDB Vue in Laravel project (I tin share the assembled demo app)!
Kind regards,
Andrey
Jakub Strebeyko staff answered four years ago
Hey Andrey, Happy to read you lot figured it out. :) Huge thank you for the time you put in explaining the problem! It makes united states of america run into issues we did non know existed. How almost I make a chore out of this, so someone at the Vue dev team can have a look at the issue? If you are OK with it, please let me know if there is whatever item Laravel setup that should be used for these tests. Are there whatever other details you think should be considered when trying MDBVue against Laravel or dealing with said "recursivity" problem? If there are things we might tweak to make MDBVue some more than Laravel-users friendly - we would very much like that. With Best Regards, Kuba
Pisarev pro answered iv years ago
Hello, Kuba, I'yard OK. I used a standart Laravel installation (the latest version five.seven). 1. My package.json has the following dependencies:
"devDependencies": { "axios": "^0.18", "bootstrap": "^4.0.0", // Laravel templates utilise Bootstrap library "cross-env": "^5.i", "jquery": "^iii.2", "laravel-mix": "^2.0", // a Laravel libraries which simpifies piece of work with webpack via clear syntax "lodash": "^iv.17.v", "popper.js": "^1.12", "vue": "^two.5.7", "bootstrap-css-only": "^4.1.one", "mdbvue": "git+https://oauth2:[my_token]@git.mdbootstrap.com/mdb/vue/vu-pro.git", "vue-router": "^three.0.ane", "babel-preset-stage-2": "^six.24.i" // information technology fixes the problem of compiling when run command "npm run dev" }
2. resources/views/welcome.bract.php add the following code:
<head> <meta name="csrf-token" content="{{ csrf_token() }}"> </head>
<body> <div id="app"> <example-component></example-component> </div> <script src="{{asset('js/app.js') }}"></script> </body>
3. resources/js/app.js add the following code:
crave('./bootstrap'); import Vue from 'vue'; window.Vue = Vue; Vue.component('instance-component', require('./components/ExampleComponent.vue')); import 'bootstrap-css-only/css/bootstrap.min.css'; import 'mdbvue/build/css/mdb.css'; new Vue({ el: '#app' });
4. Later on that you could add MDB Vue objects into resources/js/components/ExampleComponent.vue for testing If y'all take whatsoever questions, don't hesitate contact me straight (pisarev_aa@mail.ru). Kinde regards, Andrey
Jakub Strebeyko staff answered 4 years ago
Hi Andrey, Huge thank you for this! It been added as a MDB Vue Feature Request job and will accept a developer assigned to it soon. The person will probably have to go some familiarity with Laravel first, then try out the setup you shared, wait for the input fault to come upwardly and then try to resolve it, tweak export/import statements every bit advised. If it all goes well, the Vue dev squad will get together up and consider all the possible outcomes of the alter in Input.vue
and index.js
. There are many steps and procedures involved, and then I cannot be making promises at this signal, but information technology is in everyone's all-time interest that we got this figured out and is on the TODO
listing. Thank you once more, Andrey - thanks to you and people akin we are be able to improve MDB Vue farther. With Friendly Regards, Kuba
GM answered three years ago
I can confirm that I face the aforementioned problem on Laravel.
Nearly all components with the prefix "mdb-" exercise not work, of the workers I only got "mdb-navbar-make".
I apply components without the "mdb-" prefix and import them without "mdb" besides.
As well ran into a non-working component "Dropdown". Information technology is declared in alphabetize.js as "let Dropdown = require ('./components/Dropdown'). Default;". It helps to replace this line with "import Dropdown from './components/Dropdown';"
Jakub Strebeyko staff answered 3 years agone
Hi in that location @GM ,
Thanks for these details - writing a Laravel webpack build task out of this thread as we speak. The Vue team is returning from hiatus with full force next week and many issues volition be tackled. Not sure about prioritization of their task list, simply perchance this one will exist tested as well (no promises, though). At that place is a number of steps that must be undertaken to have this 1 figured out - first, in-business firm tests with Laravel Mix. Let u.s.a. know of any details you might yet have to help usa!
Anyway, thanks to you the effect will not get lost! Abandoning the effort of components name prefix standardization could not be an officially supported, but cheers for the hot-fix solution, information technology has a potential of saving someone a lot of frustration.
With Best Regards,
Kuba
Jakub Strebeyko staff answered 3 years agone
Howdy there guys,
Thanks to this thread the topic got pushed along a bit and now I'd love to share some thoughts I, a total PHP newbie, had while trying to implement mdbvue "equally is" into a fresh, bones Laravel 5.7.17 build. I would like to use it as a starting betoken for people with bodily PHP skill to gather and shed some light onto the pains and pleasures of implementation of UI libraries.
NOTE: The guide below assumes there is PHP, Composer (& others) present on the machine. If not, I plant this Laracast Laravel series a great intro smoothly guiding through the installation procedure.
MDBVUE LARAVEL HOW-TO:
ane. $ laravel new yourappname
2. $ yarn add mdbvue
3. $ yarn add together -D babel-preset-stage-2
4. in yourappname/resource/js/app.js add together - this might seem v. tricky & weird* -
import 'mdbvue/build/css/mdb.css';
5. raise a chosen blade template (default: "yourappname/resources/views/welcome.blade.php") with
a) id="app"
this is where our Vue instance volition be mounted
b) <link href="{{ asset('css/app.css') }}" rel="stylesheet" type="text/css" >
in the caput then that the default BS styles tin go attached
c) <script type="text/javascript" src="{{ asset('js/app.js') }}"></script>
in, say, lower function of the trunk so that our js goodies actually get at that place
vi. $ yarn dev
it will compile both css and vue code into the output files nosotros attached above
7. $ php artisan serve
now we should have a php server running (by default at localhost: 8000)
*From what I checked adding styles through Sass's @import argument will concatenate BS and MDB styles the wrong order and so MDBootstrap styles volition be getting overwritten by pure BS.
We should end up in an environs ready to examination & implement mdbvue.
Few things to note here: Obviously everyone knew it except me, but Laravel comes in with a default support for Vue unmarried-file-components (you can easily catechumen information technology into a React build btw). The "stub" they provide, the "yourappname/resource/js/components/ExampleComponent.vue" is a nifty identify to start! Information technology is the easiest place to import components from mdbvue to.
I must admit the road upwardly to this point wasn't so straight-forward as I thought it would, but in one case yous're here it is fairly piece of cake to estimate what works and what does non. Information technology Generally WORKS!
@GM This is the setup I was checking mdbvue components in. I take not tested them all, but of the all I did they were all prefixed and worked. Could you lot please endeavour to follow the guide and let me know whether the problems are withal there? Or mayhap without going through information technology all you lot already come across a divergence in what we did that might've contributed to the issue y'all described?
@Pisarev Thanks once again for the instruction. I discovered there is no departure in implementation, as far as I checked, between a free and pro versions of mdbvue. What is important, though, is that I did not use Laravel Mix explicitly anywhere, nor did I fiddle with original codebase, and yet I did not meet the registration / "recursiveness" problem (checked both mdbInput and mdbSelect). Exercise you think I might have missed something? Practice not hesitate to share your thoughts, I am also ready to send the project to you then you can have a look.
EVERYONE considering laravel + mdbvue stack, please go involved and follow the instructions above, get yourself a running projection, dabble with it by importing mdbvue components and share your experience - together with suggestions and bugs / inconsistencies you've experienced! That way we will cease up with full laravel support in no time! I am certain the guide is universal and can help anyone struggling with implementing a Vue UI library into a Laravel project.
With Best Regards,
Kuba
lugonet pro premium answered 3 years ago
I have the same issue. Is there any solution for this?
Unknown Custom Element: - Did You Register The Component Correctly?,
Source: https://mdbootstrap.com/support/vue/did-you-register-the-component-correctly-error/
Posted by: batesandly1946.blogspot.com
0 Response to "Unknown Custom Element: - Did You Register The Component Correctly?"
Post a Comment