Vue学习(三)

DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <script src="../static/js/vue.js">script>
head>

<body>
    <div id="app">

        {{ a }} {{ b }}
    div>
    <script type="text/javascript" >
        var data = {a : 'a',b: 'b'}
        var vm = new Vue({
            el: '#app',
            data: data,
            updated: function () {
                console.log("updated")
            }
        });
        vm.a = "new data vue"
        vm.a == data.a
        vm.$watch('a',function (newVal,oldVal) {
            console.log(newVal,oldVal);
        });
        setTimeout(function () {
            vm.$data.b = "new data vue b"
        },3000);
        vm.$data.a = "new data vue $"
        console.log(vm.$el == document.getElementById('app'))

    script>

body>
html>

你可能感兴趣的:(Vue学习(三))