提交 a17566c0 编写于 作者: E Evan

fix: 修复点击封面修改内容时不能显示分类的 BUG

上级 47a9e22e
......@@ -44,6 +44,7 @@
import EditForm from './EditForm'
import SearchBar from './SearchBar'
import ViewSwitch from './ViewSwitch'
export default {
name: 'Books',
components: {EditForm, SearchBar, ViewSwitch},
......@@ -112,8 +113,14 @@
date: item.date,
press: item.press,
abs: item.abs,
cid: item.cid
category: {
id: item.category.id.toString(),
name: item.category.name
}
}
// this.$refs.edit.category = {
// id: item.category.id.toString()
// }
}
}
}
......
......@@ -26,7 +26,7 @@
<el-input type="textarea" v-model="form.abs" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="分类" :label-width="formLabelWidth" prop="cid">
<el-select v-model="form.cid" placeholder="请选择分类">
<el-select v-model="form.category.id" placeholder="请选择分类">
<el-option label="文学" value="1"></el-option>
<el-option label="流行" value="2"></el-option>
<el-option label="文化" value="3"></el-option>
......@@ -63,11 +63,11 @@
press: '',
cover: '',
abs: '',
cid: ''
},
category: {
id: '',
name: ''
cid: '',
category: {
id: '',
name: ''
}
},
formLabelWidth: '120px'
}
......@@ -83,11 +83,10 @@
press: '',
cover: '',
abs: '',
cid: ''
category: ''
}
},
onSubmit () {
this.category.id = this.form.cid
this.$axios
.post('/books', {
id: this.form.id,
......@@ -97,7 +96,7 @@
date: this.form.date,
press: this.form.press,
abs: this.form.abs,
category: this.category
category: this.form.category
}).then(resp => {
if (resp && resp.status === 200) {
this.dialogFormVisible = false
......
......@@ -48,7 +48,6 @@
// console.log(key, keyPath)
// },
handleSelect (key, keyPath) {
console.log(key, keyPath)
this.cid = key
this.$emit('indexSelect')
}
......
......@@ -7,7 +7,7 @@
<script>
export default {
name: 'Switch',
name: 'ViewSwitch',
data () {
return {
value: true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册