我正在练习下面的代码示例。
我应用了Vuetify。
这是编辑屏幕,显示了从API提取的数据。
问题是未选中所选的v-radio
。
出什么问题了?
<v-radio-group v-model="designType" :mandatory="false" row>
<v-radio
v-for="n in 3"
:key="n"
:label="`Type ${n}`"
:value="n"
:checked="n === designType"
:aria-checked="n === designType"
/>
{{designType}} //<<----- test value is no problem
</v-radio-group>
...
// script
data() => ({
...
designType: 1,
...
}),
mounted() {
this.edit = true
this.formEdit()
,
methods: {
async formEdit() {
const apiUrl = 'http://127.0.0.1:3100/cards/'
await this.$axios.get(apiUrl + this.$route.params.id).then(res => {
this.designType = res.data.designType
})
}
}