back-end programmer, front-end learning, the problem is very simple, don"t spray me.
my code:
export default {
name: "hello",
data () {
return {
msg: "welcome",
object:{
name: "Runoob" ,
url: "Google" ,
slogan: "Taobao"
}
}
},
methods:{
doSomething: function(){
this.msg = "welcome BeiJing"
}
},
computed:{
reversedMessage:function(){
return this.msg.split("").reverse().join("");
},
site: {
// getter
get: function () {
return this.name + " " + this.url
},
// setter
set: function (newValue) {
var names = newValue.split(" ")
this.name = names[0]
this.url = names[names.length - 1]
}
}
}
};
// setter vm.name vm.url
vm.site = " https://www.runoob.com";
document.write("name: " + vm.name);
document.write("<br>");
document.write("url: " + vm.url);
my error:
HelloWorld.vue?18db:72 Uncaught ReferenceError: vm is not defined
at eval (HelloWorld.vue?18db:72)
at Object../node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/HelloWorld.vue (app.js:758)
at __webpack_require__ (app.js:679)
at fn (app.js:89)
at eval (HelloWorld.vue?9042:1)
at Object../src/components/HelloWorld.vue (app.js:1039)
at __webpack_require__ (app.js:679)
at fn (app.js:89)
at eval (selector.js?type=script&index=0!./src/App.vue:1)
at Object../node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue (app.js:750)
(anonymous) @ HelloWorld.vue?18db:72
./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/HelloWorld.vue @ app.js:758
__webpack_require__ @ app.js:679
fn @ app.js:89
(anonymous) @ HelloWorld.vue?9042:1
./src/components/HelloWorld.vue @ app.js:1039
__webpack_require__ @ app.js:679
fn @ app.js:89
(anonymous) @ selector.js?type=script&index=0!./src/App.vue:1
./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue @ app.js:750
__webpack_require__ @ app.js:679
fn @ app.js:89
(anonymous) @ App.vue?a8e9:1
./src/App.vue @ app.js:1024
__webpack_require__ @ app.js:679
fn @ app.js:89
(anonymous) @ main.js?1c90:1
./src/main.js @ app.js:1047
__webpack_require__ @ app.js:679
fn @ app.js:89
0 @ app.js:1064
__webpack_require__ @ app.js:679
(anonymous) @ app.js:725
(anonymous) @ app.js:728
vue.esm.js?efeb:8566 You are running Vue in development mode.
Make sure to turn on production mode when deploying for production.
See more tips at https://vuejs.org/guide/deployment.html
sockjs.js?3600:1605 XHR finished loading: GET "http://localhost:8080/sockjs-node/info?t=1535449391140".