美文网首页
js、jQuery、Vue对比

js、jQuery、Vue对比

作者: 久伴你_e537 | 来源:发表于2018-09-11 10:44 被阅读0次

Javascript

<div id="app">
    
</div>
<script>
var app=document.querySelector("#app");
app.innerHTML = "hello javascript";
//输出为hello javascript
</script>

jQuery

<div id="app">
    
</div>
<script>
$(function (){
   $("#app").text("hello jquery")
});
//输出为hello  jquery
</script>

Vue

<div id="app">
   {{text}}
</div>
<script>
var app = new Vue({
    el: '#app',//选中id为app的元素
    data: {
        text:'hello  Vue'
    }
});
//输出为hello  Vue
</script>

vue可以实现追加

<div id="app">
   {{text}},{{message}}。
</div>
<script>
var app = new Vue({
    el: '#app',
    data: {
        text:'hello  Vue'
         message:'今天我学习了vue' //可写多个
    }
});
//输出为hello  Vue,今天我学习了vue
</script>

相关文章

网友评论

      本文标题:js、jQuery、Vue对比

      本文链接:https://www.haomeiwen.com/subject/ievygftx.html