47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
// index.ts
|
|
|
|
import { queryGoodsList } from "../../service/shop-api"
|
|
|
|
// 获取应用实例
|
|
const app = getApp<IAppOption>()
|
|
Page({
|
|
data: {
|
|
swiperList: [
|
|
{
|
|
image: 'https://m15.360buyimg.com/mobilecms/jfs/t1/160398/4/32302/103427/6374d1f3E5b1ecb32/a593b9982d8378cc.jpg!cr_1125x449_0_166!q70.jpg',
|
|
url: null,
|
|
},
|
|
{
|
|
image: 'https://m15.360buyimg.com/mobilecms/jfs/t1/203775/20/26428/95041/637fab4dEf6a4434d/3f8770efe691537b.jpg!cr_1053x420_4_0!q70.jpg',
|
|
url: null,
|
|
},
|
|
{
|
|
image: 'https://m15.360buyimg.com/mobilecms/jfs/t1/160398/4/32302/103427/6374d1f3E5b1ecb32/a593b9982d8378cc.jpg!cr_1125x449_0_166!q70.jpg',
|
|
url: null,
|
|
},
|
|
{
|
|
image: 'https://m15.360buyimg.com/mobilecms/jfs/t1/203775/20/26428/95041/637fab4dEf6a4434d/3f8770efe691537b.jpg!cr_1053x420_4_0!q70.jpg',
|
|
url: null,
|
|
}
|
|
],
|
|
goodsItems: [],
|
|
recommendItems: []
|
|
},
|
|
onLoad() {
|
|
// 推荐商品
|
|
queryGoodsList(2, 1, 3).then((result) => {
|
|
this.setData({
|
|
// @ts-ignore
|
|
recommendItems: result.records
|
|
})
|
|
})
|
|
// 所有其他的商品
|
|
queryGoodsList(1, 1, 10).then((result) => {
|
|
this.setData({
|
|
// @ts-ignore
|
|
goodsItems: result.records
|
|
})
|
|
})
|
|
}
|
|
})
|