代码

<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue中的data数据的改变和设置方式2</title>
    <script src="https://static.gzj2001.com/vue/vue.js"></script>
    <body>
        <div id="myapp">
           <h1>{{site}}</h1>
           <h1>{{url}}</h1>
           <h1>{{alexa}}</h1>
        </div>
     
        <script>
            let info ={site:"城南博客",url:"www.gzj2001.com",alexa:611};
            let myapp = new Vue({
                el:'#myapp',
                data: info
            })
            //改变数据
            info.site = "城南花开博客";
            info.url = "www.cnhk.pro";
            myapp.alexa = 1;
        </script>
    </body>
    </html>