码迷,mamicode.com
首页 > Web开发 > 详细

浅谈Jquery和常用框架Vue变化

时间:2018-06-24 23:40:01      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:-o   图片   技术分享   bsp   title   bar   htm   区别   数据驱动   

区别

  1. 数据与视图的分离
  2. 数据驱动视图

技术分享图片

Vue 简单示例:

<div id="example-1">
    <input v-model="title" />
    <button v-on:click="add">udto list</button>
    <ul>
        <li v-for="item in items">
            {{ item.message }}
        </li>
    </ul>
</div>

  

var example1 = new Vue({
        el: ‘#example-1‘,
        data: {
            title:‘‘,
            items: [
                { message: ‘Foo‘ },
                { message: ‘Bar‘ }
            ]
        },
        methods:{
            add:function(){
                this.items.push({message: this.title})
                this.title =‘‘
            }
        }
    })

  

 

浅谈Jquery和常用框架Vue变化

标签:-o   图片   技术分享   bsp   title   bar   htm   区别   数据驱动   

原文地址:https://www.cnblogs.com/fuGuy/p/9221999.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!