vue表单示例
v-model 指令,用于在表单类元素上双向绑定数据
用@input 来替代 v-model 示例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
姓名:<textarea type="text" @input="handle" cols=20 rows=3></textarea><br/>
<span>输入的姓名是:{{name}}</span>
</div>
<script>
var v=new Vue({
el:"#app",
data:{
name:""
},
methods:{
handle:function(e){
this.name=e.target.value;
}
}
});
</script>
</body>
</html>
相关推荐
yuzhu 2020-11-16
85477104 2020-11-17
KANSYOUKYOU 2020-11-16
sjcheck 2020-11-03
怪我瞎 2020-10-28
源码zanqunet 2020-10-28
gloria0 2020-10-26
王军强 2020-10-21
学习web前端 2020-09-28
QiaoranC 2020-09-25
anchongnanzi 2020-09-21
安卓猴 2020-09-12
Macuroon 2020-09-11
kiven 2020-09-11
LittleCoder 2020-09-11
Cheetahcubs 2020-09-13
小焊猪web前端 2020-09-10
颤抖吧腿子 2020-09-04
softwear 2020-08-21