Brand new to vue.js
and working on a single-file component page where I need to submit data in the textarea
along with checking if the checkbox
is selected.
I understand that I have to include something like v-model
in the textarea
, but I'm struggling with this as the api
shown in the image below.
Could someone please guide me on what needs to be done in the data() {return {}}
section? I find this part of vue.js
quite confusing, and any assistance would be greatly appreciated.
https://i.sstatic.net/PeEx3.png
<template>
<div>
<div class="add-show">
<div>
<p class="title-comment">comment</p>
<textarea class="content-comment" placeholder="write sth here" v-model="content"></textarea>
</div>
<div class="post-wrap">
<div></div>
<div class="post-content">
<input type="checkbox" class="checkbox">
</div>
</div>
<mt-button type="primary" class="mt-button">submit</mt-button>
</div>
</template>
<script>
import dataService from 'services/dataService'
export default {
data () {
return {
content: '',
recommend: false
}
},
methods: {
addShow: function () {
dataService.postShow(profile).then(() => {
this.$toast({
message: '发布成功',
position: 'bottom'
})
})
}
}
}
</script>
<style scoped>
</style>