첫째, 새로 고칠 수있는 부모 구성 요소의 하위 어셈블리를하자, 최고의 vuex으로 갱신 할 수 할아버지 구성 요소의 서브 어셈블리를 보자
1.store이 세계에 소개 된, 상태는 지금까지 절약 할 수
const updateStore = {
state: {
confirm: false
},
mutations: {
setStore: (state, updateStoreData) => {
state.confirm = updateStoreData
}
}
}
export default updateStore
2. 서브 - 어셈블리를 직접 상태 변화, 삭제 작업 후에 수행, 그것은 인터페이스 오이 수행해야 함을 기억
deleteStocking(id) {
const _this = this
this.$confirm('删除此信息', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
warehouseApi.stocking.deleteStocking({ id }, res => {
this.$message.success(res.msg)
this.$store.commit('setStore', true)
this.handlePageCurrentChange(1)
})
})
},
3. 계산 된 내부는 다시 변경됩니다 인터페이스를 호출하여 최신 데이터 및 새로 고침 상태를 얻을 수 있습니다
computed: {
submitStatus () {
return this.$store.state.updateStore.confirm
}
},
watch: {
submitStatus (val) {
if (val) {
Promise.all([this.getWarehouseDetail(), this.getInventoryDetail()]).then(()=> {
this.$store.commit('setStore', false)
})
}
}
},