
In the previous section, we introduced the data transfer of parent-child components. 1 // Component Constructor Constructs Components: 2 var M圜omponent = Vue.extent( Parametric 2 (DI DIDIComponent): The hook constructor of the registered component, Function, can also be Object. It is also possible not to use a connector (dashed line) nor a small hump name. There are also irregular ways of writing to directly customize any English character. The inner part of UE automatically matches to the HTml custom tag with a dashed line, that is,'didi-component'equals'didiComponent'. Names can be defined by using the small hump naming method, in addition to using the middle line and adding the custom tag in html. Parameter 1 ('didi-component'): Register the name of the component, that is, you can add the component in HTML by using the custom tag of the corresponding name. component ('didi-component', DIDIDIComponent) Compared with traditional MVC, this can be understood as the logic of Controller is dispersed into these hook functions.ġ.1 Global component registration: Vue. In these hook functions, we can encapsulate some custom logic. Declare periodic hook functions: (lifecycle hooks) A component triggers multiple lifecycle hook functions, such as create, attach, destroyed, etc.User input events and component methods can be bound by v-on instructions. METHODS: Data modification is usually done in the component method.The default parameter is one-way binding (top-down), but it can also be explicitly declared as two-way binding. Receiving external parameters: (props) data transfer and sharing between components through parameters.For reusable components, it is usually a private state. Initial data: (data) The initial data state of a component.Template: (template) Template declares the mapping relationship between data and the DOM that is ultimately presented to the user.It would be nice to get some more input from other community members interested in this. Please feel free to correct me if I'm wrong. Which makes sense in that case, but not when you define your Less/SASS/whatever locally, in-file. As far as I'm aware style tag does not even have a rel attribute in the specification, but it does have lang, as a global one: And, if you look again at the Less documentation you linked, you can see they use it not in a local context of a style tag, but in a link. However, looking at the semantics of both rel and lang attributes, I believe lang is a far better option. In your example, vue-loader would transform it as a SASS file, but WebStorm would apply formatting for Less.


So Vue allows to create components in a single file, like so: Then, single file components are being transformed using vue-loader:
