Problem:
Is the variable that I assigned to data in the interface, and then the effect of the component doesn't come out (my rotation effect)
The code is as follows:
Data () {return
{
slides: []
}
},
Mounted () {
this.request ()
},
methods: {
request () {this
. $http. Post (' Xxxxxxxxxxxx ', {},
Res) => {
if (Is.object (res)) {
if (res.status = = ' succ ') {
this.slides = res.data.useddevice_list< C13/>console.log (this.slides)
} else {
Console.log (res)}}
else {this
. $toast. Show (' Load failed '
}}
, (data) => {this
. $toast. Show (' request data failed ')
}}}
Print out also has the data (but the component side does not have the effect) and so on function
Solution: because he is a [], the first time you go to the loading of data must be undefined, Vue official said it is best to advance all the attributes declared good. With or without the data, give him a null.
Data () {return
{
slides: [null]
}
},
Mounted () {
this.request ()
},
methods: {
request () {this
. $http. Post (' Xxxxxxxxx ', {},
(res => {
if (Is.object (res)) {
if (res.status = = ' succ ') {
this.slides = res.data.useddevice_list
Console.log (this.slides)
} else {
console.log (res)
}}
else {this
. $toast. Show (' Failed to load ')
}
, (data) => {this
. $toast. Show (' request data failed ')
}}