上传代码

This commit is contained in:
2025-08-18 14:20:34 +08:00
commit 527fd07910
2408 changed files with 427370 additions and 0 deletions

View File

@ -0,0 +1,45 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
data() {
return {
menuItems: [
{ name: "牛肉面", price: 18 },
{ name: "炒饭", price: 15 }
],
cart: []
};
},
methods: {
addToCart(item) {
this.cart.push({ ...item });
},
removeFromCart(index) {
this.cart.splice(index, 1);
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.f($data.menuItems, (item, index, i0) => {
return {
a: common_vendor.t(item.name),
b: common_vendor.t(item.price),
c: common_vendor.o(($event) => $options.addToCart(item), index),
d: index
};
}),
b: $data.cart.length > 0
}, $data.cart.length > 0 ? {
c: common_vendor.f($data.cart, (cartItem, cartIndex, i0) => {
return {
a: common_vendor.t(cartItem.name),
b: common_vendor.t(cartItem.price),
c: common_vendor.o(($event) => $options.removeFromCart(cartIndex), cartIndex),
d: cartIndex
};
})
} : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);

View File

@ -0,0 +1,6 @@
{
"navigationBarTitleText": "学生中心",
"navigationBarBackgroundColor": "#4095e5",
"enablePullDownRefresh": false,
"usingComponents": {}
}

View File

@ -0,0 +1 @@
<view class="cart-page"><view wx:for="{{a}}" wx:for-item="item" wx:key="d"><view>{{item.a}} - {{item.b}}元</view><button bindtap="{{item.c}}">+</button></view><view wx:if="{{b}}"><view>购物车中的商品:</view><view wx:for="{{c}}" wx:for-item="cartItem" wx:key="d">{{cartItem.a}} - {{cartItem.b}}元 <button bindtap="{{cartItem.c}}">-</button></view></view></view>