2018-09-15

  • 1.v-text

<div id='app'>
<input type="text" v-model='msg'>
<p v-html='msg'>{{msg}}</p>
<h3 v-text='msg'>{{msg}}</h3>

   <a href="#" v-once>{{msg}}</a> <br>
   <a href="#" v-pre>{{msg}}</a>

</div>
<script src='js/vue.js'></script>
<script>
new Vue({
el:'#app',
data:{
msg:'今天周六,照常上课'
}
})

</script>

*2.v-cloak

<div id='app'>
<h1 v-cloak>{{msg}}</h1>
</div>
<script src='js/vue.js'></script>
<script>
new Vue({
el:'#app',
data:{
msg:'hellovue'
},
beforeMount:function(){
alert(1111)
}
})

</script>

*3.shopping

<div id='app'>
<input type="text" v-model='msg'>
<p v-html='msg'>{{msg}}</p>
<h3 v-text='msg'>{{msg}}</h3>

   <a href="#" v-once>{{msg}}</a> <br>
   <a href="#" v-pre>{{msg}}</a>

</div>
<script src='js/vue.js'></script>
<script>
new Vue({
el:'#app',
data:{
msg:'今天周六,照常上课'
}
})

</script>

*4.用户管理
<div class='container'>
<form>
<div class='form-group'>
<label>用户名</label>
<input type="text" placeholder="请输入用户名" class='form-control' v-model='student.uname'>
</div>
<div class='form-group'>
<label>密码</label>
<input type="text" placeholder="请输入密码" class='form-control' v-model='student.age'>
</div>
<div class='form-group'>
<label>邮箱</label>
<input type="text" placeholder="请输入邮箱" class='form-control' v-model='student.email'>
</div>
<div class='form-group text-center'>
<input type="button" value='添加' class='btn btn-success' v-on:click='add'>
<input type="button" value='重置' class='btn btn-info'>
</div>
</form>
<table class='table table-bordered text-center'>
<thead>
<tr>
<th>编号</th>
<th>姓名</th>
<th>年龄</th>
<th>邮箱</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="(value,index) in user">
<td>{{index+1}}</td>
<td>{{value.name}}</td>
<td>{{value.age}}</td>
<td>{{value.email}}</td>
<td>
<button v-on:click='delt(index)'>删除</button>
</td>
</tr>
</tbody>
</table>
</div>
<script src='../js/vue.js'></script>
<script type="text/javascript">
new Vue({
el:".container",
data:{
user:[
{uname:'jack',age:18,email:'abc@126.com'}
],
student:{}
},
methods:{
add:function(){
var newStu={};
for(var i in this.student){
newStu[i]=this.student[i];
}
this.user.push(newStu);
},
delt:function(ind){
this.user.splice(ind,1)
}
}
})

</script>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • JSON APIS and AJAX Description:*Introduction to the JSON ...
    王策北阅读 579评论 0 1
  • 1.人生目标要符合三个要素:积极的,发自内心的和超越个人的 2.古语有云:法乎其上,则得其中;法乎其中,则得其下;...
    媚儿大人阅读 488评论 0 1
  • 1. 曾经有一位辛勤的田鼠老先生,辛苦一生,过上了算是体面的日子。有一天,他热情地款待了一位衣衫褴褛的流浪汉。田鼠...
    王雅_写给精灵人阅读 854评论 0 0
  • 富文本编辑器 借助富文本编辑器,管理员能够编辑出来一个包含html的页面,从而页面的显示效果,可以由管理员定义,而...
    lyh165阅读 161评论 0 0
  • (玄在古代是黑色的意思,题目也可作黑海) 我潇洒的活着,不欢不快,不人不鬼,不伦不类。 朋友告诉我,当你看到大海,...
    狸追先生阅读 372评论 0 0