#### **axml代码**
```
<form class="carform mg_b10" onSubmit="formSubmit" onReset="formReset">
<view class="list">
<am-vtabs tabs="{{goodsCateList}}" onTabClick="handleChange" data-address-id="{{items.id}}" onChange="onChange" activeTab="{{activeTab}}" sameFontSize="{{false}}" tabBarlineShow="{{false}}">
<vtab-content>
<view a:for="{{goodsList[activeTab]}}" a:for-item="items" a:key="key">
<am-input-item type="text" placeholder="{{items.measureunit}}">{{items.goodsname}}:</am-input-item>
</view>
</vtab-content>
</am-vtabs>
</view>
<view class="fixbtn">
<button loading="{{submitLoading}}" disabled="{{submitLoading}}" formType="submit">下一步</button>
</view>
</form>
```
*****
#### **js代码**
```
import stockApi from "/api/impl/stockApi";
Page({
data: {
activeTab: 0,
goodsCateList:[],
goodsList:[],
pageList: [],
tabs: [
{ title: '分类1', anchor: 'a' },
{ title: '分类2', anchor: 'b'},
{ title: '分类3', anchor: 'c'},
],
category:[
{title:'芽菜', anchor: 'a'},
{title:'白菜',anchor:'a'},
{title:'食用油',anchor:'b'},
{title:'番茄',anchor:'b'}
]
},
// 页面加载
onLoad() {
this.getGoodsCateGory();
this.getGoodsList();
},
handleChange(index) {
this.setData({
activeTab: index,
});
this.afterTabChange();
},
// onChange(index) {
// this.setData({
// activeTab: index,
// });
// },
// tab发生改变
afterTabChange() {
let _this = this;
let goodsList = _this.data.goodsList;
let activeTab = _this.data.activeTab;
let itemList = goodsList[activeTab] ? goodsList[activeTab] : [];
if (itemList.length <= 0) {
_this.getGoodsList();
}
},
onReachBottom() {
// 页面被拉到底部
this.getGoodsList();
},
//获取商品栏目列表
getGoodsCateGory: function(){
let self = this
stockApi.getGoodsCateGory().then(function(res){
let data = res.data
self.setData({
goodsCateList: data
})
})
},
// 获取商品列表
getGoodsList: function () {
let _this = this;
let goodsCateList = _this.data.goodsCateList;
let goodsList = _this.data.goodsList;
let activeTab = _this.data.activeTab;
let itemList = goodsList[activeTab] ? goodsList[activeTab] : [];
let page = _this.data.pageList[activeTab] ? _this.data.pageList[activeTab] : 1;
let setFiled = 'goodsList[' + activeTab +']';
let setPage = 'pageList[' + activeTab +']';
let params = new Object();
params.page = page;
params.cateid = goodsCateList[activeTab] ? goodsCateList[activeTab].id : 0;
stockApi.getGoodsList(params).then(res => {
let resData = res.data;
_this.setData({
[setFiled]: itemList.concat(resData),
[setPage]: page + 1
})
}).catch(err => {
})
},
});
```