嘿家伙我使用这lib,此刻我正在尝试一个简单的排序,想象我有一个数组与3个元素,我想改变他的立场与拖动,我是能够做到这一点。事情是,当我swich的地方我的JSON数组不更新。VueJS可拖拽/可排序JSON不更新
我这样做:
我的列表:
<draggable v-model="getDocumentAttributes">
<div v-if="value.key != 'Document'" class="panel panel-primary" v-for="(value, key, index) in 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吸气:
getDocumentAttributes(){
return this.$store.getters.getDocumentAttributes;
}
Finaly我的名单,我的getter函数在vuex方面:
state: {
document: { "id": "0", "atributes": [] },
[...]
getDocumentAttributes: (state) => {
return state.document.atributes;
},
我对vuex有同样的解决方案,但是我的setter永远不会被调用,我需要为此做些什么? –
。^。 “......你只能用突变来改变vuex状态。” – Reiner
我知道,但它不解释随着dragable /可排序如何做到这一点,我应该在哪里打电话集() –