//初始化,拉取
constructor() {
super();
that = this;
this.state = {
tagList: [],
bannerList: [],
newsList: [],
data: [1, 2, 3]
}
//获取头部tags信息
axios({
method: 'get',
url: '/api/cate/cate_list'
}).then(function (response) {
if (response.data.code === 0) {
//循环绑定data active
for (var item of response.data.data) {
item.active = false;
}
that.setState({
tagList: response.data.data
});
}
})
}
//render绑定数据
render() {
var tabpanes = this.state.tagList.map((item, index) => (
));
return
{this.state.tagList.length}
{tabpanes}
}
//结果始终显示不出来,不知道问题出在哪,请老师帮忙解答一下。