wuqy-component
Version:
这是一个微信小程序自定义组件库
90 lines (83 loc) • 2.44 kB
JavaScript
import { createStoreBindings } from "mobx-miniprogram-bindings";
import { store } from "../../tools/store";
Page({
/**
* 页面的初始数据
*/
data: {
logisticsStatus: "已收货",
orderNumber: 20240620542,
money: 99,
orderTime: "2024-06-20 10:51:12",
rotate: 0,
goodsData: [
{ id: 1, name: "商品A", price: 99.99, quantity: 10 },
{ id: 2, name: "商品B", price: 149.99, quantity: 5 },
{ id: 3, name: "商品C", price: 79.99, quantity: 20 },
{ id: 4, name: "商品D", price: 199.99, quantity: 2 },
{ id: 5, name: "商品E", price: 49.99, quantity: 15 },
{ id: 6, name: "商品F", price: 299.99, quantity: 1 },
{ id: 7, name: "商品G", price: 129.99, quantity: 8 },
{ id: 8, name: "商品H", price: 59.99, quantity: 12 },
{ id: 9, name: "商品I", price: 39.99, quantity: 25 },
{ id: 10, name: "商品J", price: 89.99, quantity: 6 },
],
},
refundInfo(e) {
//除了表单中的信息,还要携带订单的具体信息和用户上传的图片信息。
console.log(e.detail.value);
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.storeBindings = createStoreBindings(this, {
store,
fields: ["numA", "numB"],
actions: {
update123: "update",
},
});
const selected = new Array(this.data.goodsData.length).fill(false);
this.setData({
selected: selected,
});
},
selectGoods(e) {
console.log(e);
let selected = this.data.selected;
const index = e.currentTarget.dataset.selectindex;
selected[index] = !this.data.selected[index];
this.setData({
selected,
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {},
});