<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>实操题</title>
</head>
<body>
    <div id="app">
        <h3>自我介绍</h3>
        <p>methods:{{sayHello()}}</p>
        <p>computed:{{sayHello2}}</p>
        <p>watch:{{jieshao}}</p>
    </div>

    <script src="../js/vue.js"></script>

    <script>
        let person = {
            name:'什么',
            city:'某某',
            jieshao:''
        };

        let vm = new Vue({
            el:'#app',
            data:person,
            methods:{
                sayHello:function () {
                    return `我叫${this.name},来自${this.city}城市`;
                }
            },
            computed:{
                sayHello2(){
                    return `我叫${this.name},来自${this.city}城市`;
                }
            },
            watch:{
                name:{
                    handler(){
                        this.jieshao = `我叫${this.name},来自${this.city}城市`;
                    },
                    immediate: true
                }
            }
        });
    </script>
</body>
</html>