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?
FileReader is used to read files locally, generally only applicable to <input type="file"></input>
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
FileReader is used to read files locally, generally only applicable to
<input type="file"></input>
And your title and content have nothing to do with FileReader. They are only affected by newPost in your
data()
. So you can changevm.post.push({img: this.result})
in creatPost toIsn’t the data already in
this.newPost
?You bind the data of
this.newPost
to the dom through v-model. Instead of getting it fromthis.newPost
, you get the data from the dom instead?