The method in vue methods can't change the value of data?

clipboard.png

value

:

clipboard.png

but other fields can be changed, but value can"t be changed all the time. It is speculated that it may have something to do with the keyword value.

Mar.18,2021
Modify the value of an item in the array directly in

vue. Vue cannot detect the change. I don't know if the value printed by console.log has not changed. Or the data on the page has not changed
ide/list.html-sharp%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/guide.


directly changing the value in the data vue cannot be detected unless you use

  • push ()
  • pop ()
  • shift ()
  • unshift ()
  • splice ()
  • sort ()
  • reverse ()

so you can use this.$set (this.tranList,this.tranList [index], item+1)


there's nothing wrong with your current code
as for checking the array,
forEach it actually means
this.tranlist [0] .value + = 1 Vue recursively handles data , so it's no problem
arr [0] = 1 the array can't be changed
arr [

No change can be detected by directly modifying the value
you need to use the code
import Vue from 'vue'

on the
method of Vue.

Vue.set (this.tranList, 1, {

)
value: 0,
name: '',
text: ''

})


is your data obtained by ajax? Is tranList set to null when data is initialized or does it not exist at all? If this property is not defined before ajax, it will not be monitored. You need to use this.$set ('tranList',data) to assign a value after ajax succeeds

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb3987-48230.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb3987-48230.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?