On the question of Cannot read property 'bar' of undefined

message is an empty object,

    var app = new Vue({
      el: "-sharpapp",
      data: {
        message: {},
      },

and then in

<input ... v-model="message.foo">


<input ... v-model="message.foo.bar">

clipboard.png

how do you explain this?

Feb.27,2021

message is an empty object. Foo is not initialized in message.foo, so you cannot take a value for undefined,undefined, that is, you cannot message.foo.bar

.
//
message: {foo:{}},
Menu