Home > Article > Web Front-end > What should you pay attention to when using vue.js
Things to note when using vue.js: 1. Filters are mainly used for simple text conversion; 2. The difference between computed and methods; 3. The use of keys; 4. The use of arrays; 5. The use of components ; 6. Component communication.
The environment of this article: windows10, vue2.9, Dell G3 computer.
(Learning video sharing: javascript video tutorial)
You need to pay attention to the following issues when using vue.js:
1. Filters are mainly used for simple For text conversion, if you want to implement complex data transformation, you should use calculated attributes
2, use of instructions
v-bind is basically used for attributes on HTML elements , such as id, class, href, src, etc.
v-on is used to bind event listeners, such as click, dblclick, keyup, mousemove, etc. This in the method points to The current Vue instance
v-show cannot be used on template
<input key="go">5. The use of array
Some array changes cannot be detected by Vue, and the view will be updated
b46d877062534c12e785ba01b088db9c, c34106e0b4e09414b63b2ea253ff83d6, 221f08282418e2996498697df914ce4e are restricted by HTML, and only restricted tags are allowed. Custom component tags are invalid.
At this time, you can use the is attribute to mount the component<table> <tbody is="my-component"></tbody> </table>
Note: However, when using a string template, it does not Restricted. Such as .vue file
7, component communication
The above is the detailed content of What should you pay attention to when using vue.js. For more information, please follow other related articles on the PHP Chinese website!