import { getProducts } from '~/api/global' const app = getApp() Component({ properties: { }, data: { show: false, products: [], // 是否购买过vip isIos: app.globalData.isIOS, isPreferential: false }, methods: { open() { this.getProducts() this.setData({ show: true, }) }, closeModal() { this.setData({ show: false }) }, async getProducts() { let { isPreferential, productList: products, } = await getProducts() this.setData({ products, isPreferential }) }, toBuy({ currentTarget }) { this.triggerEvent('toBuy', currentTarget.dataset.goods) } } })