12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import {
- getProducts
- } from '~/api/global'
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- },
- /**
- * 组件的初始数据
- */
- data: {
- show: false,
- products: [],
- // 是否购买过vip
- 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
- })
- },
- triggerPay({
- currentTarget
- }) {
- console.log(currentTarget.dataset.goods);
- this.triggerEvent('toBuy', currentTarget.dataset.goods)
- }
- }
- })
|