例如:接口data对象中有top-img,前端需要拿到数据得这么写:
this.TopImg = res.data.bestsellers['top-img'];//正确写法
this.TopImg = res.data.bestsellers.top-img;//错误写法,会报img is not defined
例如:接口data对象中有top-img,前端需要拿到数据得这么写:
this.TopImg = res.data.bestsellers['top-img'];//正确写法
this.TopImg = res.data.bestsellers.top-img;//错误写法,会报img is not defined