In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
It is believed that many inexperienced people have no idea about how to understand the interpolation expression in vue basic grammar. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
I. introduction of the vscode plug-in
Before we demonstrate the interpolation expression, let's install this plug-in provided by VScode, which can access our written web pages through the service port. At the same time, it has another advantage: after modifying the code, there is no need for us to manually click to refresh, the plug-in will help us to refresh automatically, is it very convenient and improve our development efficiency? It saves us the operation of clicking a refresh every time we modify the code.
The installation steps are shown in the following figure: install the Live Server plug-in
After we install the plug-in, restart the VScode editor, and then you can right-click on a html page, select the open with Live Server option, and open it. You can also use the shortcut key: alt+L and then press alt+o to open it in the browser through the plug-in we installed.
After opening it, we can see the browser opened on this port of 127.0.0.1purl 5500 in the address bar.
Introduction of interpolation expression
Mounting elements can use the template syntax of Vue.js, and the template can set the dynamic content of the element through interpolation expressions, written as {{}}.
Example of interpolation expression 1
We can write the arithmetic operation in the internal interpolation expression of the mounted element, which will help us to carry out the result automatically.
Let's demonstrate that instead of vue mounting elements, we just use the interpolation expression and then run it in the browser.
The result is: {{1 + 2 + 3}}: {1 + 2 + 3}}
It is found that the running result does not help us to calculate the result, but shows us the content written in the tag element directly as plain text.
Example of interpolation expression 2
After vue mounts the element, we use the interpolation expression, and then run it in the browser.
The result is: {{1 + 2 + 3}} new Vue ({el:'#app'})
Through the operation, we found that our calculation results are shown! This shows that the mathematical calculation function is the function of our vue interpolation expression, if we do not specify the mount element, then it is equivalent to not using the function of vue, the effect we display is the effect of ordinary text.
Fifth, attention points of interpolation expression
Interpolation expressions can only be written in the tag content area and can be mixed with other content.
New Vue ({el:'#app'})
Only JavaScript expressions can be written internally, not statements.
{{var I = 0}} new Vue ({el:'#app'}) {{var I = 0}} new Vue ({el:'#app'})
VI. Supplement of interpolation expression
Interpolation expressions can write not only mathematical operations, but also ternary operators.
{{10 > 20, 10 > 20, 10 > 20, 10, 10, 10, 10, 10, 10, 10, 20, 10, 10, 10, 10, 20, 10, 10, 10, 10, 10, 20, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 20, 10, 10, 20, 10, 10, 20, 10, 10, 20, 10, 10, 20, 10, 10, 10, 20, 10, 10, 10, 20, 10, 10, 10, 20, 10, 10, 10, 20, 10, 10, 20, 10, 10, 10, 20, 10, 10,
After reading the above, have you mastered how to understand the interpolation expressions in the basic grammar of vue? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.