<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="app">
        title:<input type="text" v-model="title">
        name: <input type="text" v-model="name">
        <input type="button" value="修改计算属性" @click="changeName">
    </div>

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

    <script>
        const vm = new Vue({
            el:'#app',
            data:{
                title:'美人剑',
                name:'黄金殿'
            },
            methods:{
                changeName(){
                    this.fullName = '方可贵-名满天下';
                }
            },
            computed:{
                'fullName':{
                    get:function () {
                        return this.title + '-' + this.name;
                    },
                    set:function (newValue) {
                        var parts = newValue.split('-');
                        this.title = parts[0];
                        this.name = parts[1];
                    }
                }
            }
        })
    </script>
</body>
</html>