Vue.component()
时间: 2023-08-29 07:13:32 浏览: 131
Vue.component() is a method used in Vue.js to create a custom component. It takes two arguments: the name of the component and an object with various options for configuring the component.
For example, to create a custom component called "my-component", we would write:
```
Vue.component('my-component', {
// options for the component
})
```
The options object can include properties such as "template" (the HTML template for the component), "props" (the properties that can be passed into the component), "data" (the component's internal data), and "methods" (functions that can be called within the component).
Once a component is created using Vue.component(), it can be used in other Vue instances or components just like any other built-in Vue component.
阅读全文