1 Page({ 2 data: { 3 TestData: '0' 4 }, 5 6 TestData: '1', 7 8 onLoad () { 9 console.log(this.data.TestData) 10 console.log(this.TestData) 11 12 this.setData({ 13 TestData: "0嘿嘿" 14 }) 15 this.TestData = "1嘿嘿" 16 17 console.log(this.data.TestData) 18 console.log(this.TestData) 19 }, 20 21 })
9: 0
10: 1
17: 0嘿嘿
18: 1嘿嘿
不将数据写到Data不就行了?!