<!DOCTYPE html><html><head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="./vue.js"></script> <!-- <script src="http://cdn.staticfile.org/vue/2.6.10/vue.common.dev.js"></script> --></head><body> <div id="app">{{fullName}}</div> <script type="text/javascript"> var vm = new Vue({ el: "#app", data: { firstName: "Tom", lastName: "Cat" }, computed: { /*fullName: function() { return this.firstName + " " + this.lastName }*/ fullName: { get: function() { return this.firstName + " " + this.lastName }, set: function(value) { var arr = value.split(" "); this.firstName = arr[0]; this.lastName = arr[1]; console.log("我是" + value) } } } }) </script></body></html>