-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in beforeMount hook: "Error: Please provide a component #9
Comments
hello, sorry for the late response |
there are two way for importing components
when we use the require keyword, since v13, vue-loader exports the component as the default key, we can access that component via .default ( if you using vue-cli ) component: require("./modal.vue").default, i think in older versions you can require your component without using the .default keyword ( there is no default keyword in > 13v that's why you getting the error ) component: require("./modal.vue") using import <script>
import Vue from "vue";
import xmodal from "xmodal-vue";
// our modal
import modal from "./modal.vue";
Vue.use(xmodal);
export default {
name: "App",
data() {
return {
ismodalOpen: false,
// basic modal options
options: {
component: modal,
backgroundColor: "#000000",
opacity: "0.7",
animation: "scaleLeft",
},
};
},
};
</script> online demo: codesandbox if you using require, can u please console log component property for me in beforeMount hook so I can check what is going on beforeMount(){
console.log(this.options.component);
} thanks |
dude your component is ok , it was my mistake that i figure it out just now , when test your solutions . |
i will work on an alternative solution for import components. require is a little bit confusing anyway have fun |
"xmodal-vue": "^0.2.0"
"vue": "^2.6.11"
thanks for this pakcage.
i want to run simple example but its give this error in console :
the component path is true , but when i remove
.default
from end of component path the error solve but when i click on the button , nothing happen.this is my code like your example :
html:
introduction.js:
and this is the modal.vue :
The text was updated successfully, but these errors were encountered: