javascript - Getting Vue to update on object update -


how can vue js update, when update object in vuex?

right have mutation

edit_user (state, user) {     const record = state.users.find(element => element.id === user.id)     let index = state.users.indexof(record)     state.users[index] = user }, 

this works @ object level, , in console state.users object indeed updated. view, doesnt automatically update.

if splice first, , push, works intended, , view gets updated...but ugly.

  edit_user (state, user) {      const record = state.users.find(element => element.id === user.id)      state.users.splice(state.users.indexof(record),1)s      state.users.push(user)   }, 

its ugly because afterwards, @ new index, makes jump around in table view after update. not desired user experience here.

id more, 'edit in place' style thing.

how can vue re-render, if update object? either, locally, asynchronously, or outside via websockets

i thought supposed reactive, , automatic, why chose framework on jquery. starting jquery would've been better choice, since would've solved hours ago already, , not stuck 5 hours, on such dumb thing.

refer section in vue documentation: https://vuejs.org/v2/guide/list.html#caveats

you need use 1 of following methods vue detect array change.

// vue.set vue.set(example1.items, indexofitem, newvalue)  // array.prototype.splice example1.items.splice(indexofitem, 1, newvalue) 

Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -