我使用可拖動和可排序與vuejs,我有一個問題,每次我改變兩個div的位置,例如,他們改變,但json數組不更新。排序陣列沒有更新時更改位置
我與vuex的工作,我有我的組件模板這個網站:
<draggable v-model="myList">
<div class="panel panel-primary" v-for="(value, key, index) in this.$store.getters.getDocumentAttributes">
<div class="panel-body quote">
<span @click="removeSection(index,key)" class="pull-right glyphicon glyphicon-remove text-info"></span>
<p>{{value.key}}</p>
</div>
</div>
</draggable>
然後我得到了我的計算道具是獲取和設置是來自vuex數據,
computed: {
sections() {
return this.$store.getters.getDocument;
},
myList: {
get() {
return this.$store.getters.getDocument.getDocumentAttributes;
},
set(value) {
this.$store.commit('updateList', value)
}
}
},
的updateList應該更新我的列表(如果我想好),所以我有這樣的:
},
mutations: {
updateList: (state,list) => {
state.Doc.atributes = list;
}
},
document: { "id": "0", "atributes": [] },
我嘗試重新將舊數組與新的匹配與atributes數組,任何幫助?
ps:文件在數據裏面,我只是試着放置必要的代碼。
感謝
你可以有你有什麼迄今所以我們可以看到發生了什麼一點點演示? –
對不起atm我不能這樣做真的想,但我試圖解釋更好 –
此刻我可以拖動一個div和兩個div之間的變化位置,但他們不會更新我的json,我的json不' t refresh:/, –