<div id="app">{{fullName}}</div>
var app = new Vue({
el: "#app",
data: {
firstName: "xiao",
lastName: "dongxier"
},
computed: {
fullName: {
get: function () {
return this.firstName + " " + this.lastName;
},
set: function (val) {
console.log(val);
var arr = val.split(" ");
this.firstName = arr[0];
this.lastName = arr[1];
}
}
}
});
This Pen doesn't use any external CSS resources.