Commit 9201a8ba authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

add select parent_id

parent 5d98f35a
......@@ -23,13 +23,12 @@
min="1"
required
/>
<label>Parent ID :</label>
<input
type="text"
class="form-control mb-2"
placeholder="Parent ID"
v-model="parent_id"
/>
<label>Parent :</label>
<b-form-select v-model="parent_id">
<option v-for="item in categories" :value="item.id">
{{item.name}}
</option>
</b-form-select>
<label>Ordering :</label>
<input
type="text"
......@@ -38,7 +37,6 @@
v-model="ordering"
required
/>
<b-form-select v-model="selected" :options="options"></b-form-select>
<label>Image :</label>
<b-form-file
@change="fileSelected"
......@@ -205,7 +203,7 @@ export default {
middleware: ["web"],
data: () => {
return {
parent_id:'',
parent_id: null,
name:'',
ordering:'',
image: null,
......@@ -320,13 +318,15 @@ export default {
});
},
createCategory() {
const self = this
const set = new Set([this.image]);
const image = Array.from(set);
const self = this;
axios
.post('http://127.0.0.1:8000/api/categories/',{
name: this.name,
ordering: this.ordering,
parent_id: this.parent_id,
image: this.image,
image: image,
}, {
headers: {
"Content-Type": "multipart/form-data",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment