我想确认我的操作是正确的。设置类别ID或打开模式编辑帖子时,我需要绑定选定的内容
<select v-model="form.category_id" id="category" name="category"
class="form-control" :class="{ 'is-invalid': form.errors.has('category') }">
<option v-for="category in categories.data" :value="category.id" v-bind:selected="category.id != null">{{category.name}}</option>
</select>
<has-error :form="form" field="category"></has-error>
export default {
data() {
return {
editmode: false,
categories:[],
}
}
}