亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - Problems with reading data in vuejs
扔個三星炸死你
扔個三星炸死你 2017-06-24 09:43:38
0
2
936

As shown in the picture, I used vuejs to write a small demo for posting, but now I can only read the img field in the post. How to read all the fields?

html code

js code

扔個三星炸死你
扔個三星炸死你

reply all(2)
小葫蘆
  1. FileReader is used to read files locally, generally only applicable to <input type="file"></input>

  2. And your title and content have nothing to do with FileReader. They are only affected by newPost in your data(). So you can change vm.post.push({img: this.result}) in creatPost to

vm.post.push({
    title: vm.newPost.title,
    content: vm.newPost.content,
    img: this.result
})

// 同時在最后把post清空
Object.keys(vm.newPost).forEach(item => vm.newPost[item] = '')
phpcn_u1582

Isn’t the data already in this.newPost?

You bind the data of this.newPost to the dom through v-model. Instead of getting it from this.newPost, you get the data from the dom instead?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template