当前位置:网站首页>(7) Attribute binding
(7) Attribute binding
2022-06-09 04:13:00 【liuyang___】
1、vue How to handle attributes dynamically
v-bind Instruction usage
<a v-bind:href='url'> Jump </a>
Abbreviation form
<a:href='url'> Jump </a>
<div id="app">
<a v-bind:href="url" v-text="baidu"></a>
<a :href="url"> Baidu 1</a>
<button v-on:click="handle"> Switch </button>
</div>
<script>
var vm = new Vue({
el:"#app",
data:{
url:'http://www.baidu.com',
baidu:' Baidu '
},
methods:{
handle:function(){
// modify url Address
this.url = 'http://itcast.cn'
this.baidu=' Spreading wisdom Podcast '
}
}
})
</script>
Click to switch , Click Baidu again , Will switch url Value , Go to another page .
v-model The essence of
<div id="app">
<div>{
{msg}}</div>
<input type="text" v-bind:value="msg" v-on:input="handle">
<input type="text" v-bind:value="msg" v-on:input="msg=$event.target.value">
<input type="text" v-model="msg">
<!-- v-model The essence of -->
</div>
<script>
var vm = new Vue({
el:'#app',
data:{
msg:'hello'
},
methods:{
handle:function(event){
// Use the latest data in the input field to overwrite the original data
this.msg = event.target.value;
}
}
})
</script>边栏推荐
猜你喜欢
![[SWPU2019]ReverseMe](/img/82/e8160f4128bfa09af53443cf219491.png)
[SWPU2019]ReverseMe

PHP deserialization recurrence - no response to the bugku login

声学工程师应知道的150个声学基础知识(全篇)

瑞芯微rk3399开发板底板原理分析

基于PyQt5完成的PDF合并

Pdf merge based on pyqt5

测试网站搭建+渗透+审计之第三篇Swagger接口渗透测试

Online Morse code online translation and conversion tool

Iscc-2022-reverse-mobile- part WP

National information security competition for college students (ciscn) -reverse- recurrence (part)
随机推荐
Graph to document function based on pyqt5
《Attention-ocr-Chinese-Version-mas # ter》代码运行逻辑
Erreur! Il n'y a pas de texte de style spécifié dans le document. (1)
在线JSON转XML工具
Status mode simulates elevator operation
状态模式模拟电梯运行
Rigidbody2d rotate around a fixed point rotate
Pdf merge based on pyqt5
Kotlin basics from getting started to advanced series (Introduction) basic use of file storage
Test website construction + penetration + audit Part III penetration test of swagger interface
Golang - - paquet d'exécution simultané
(3) VGg reproduction
Harbor容器安装以及相关特性部署与使用(SSL证书+AD域)
Lua operator
常用端口记录
上网行为组网
Golang-- concurrent runtime package
复杂查询 指什么,包括哪些
Golang ---- storage of variables and their contents
Differences and principles between hashrouter and historyrouter