上传代码
This commit is contained in:
0
uniapp04/unpackage/dist/dev/mp-alipay/pages/forums/forums.acss
vendored
Normal file
0
uniapp04/unpackage/dist/dev/mp-alipay/pages/forums/forums.acss
vendored
Normal file
1
uniapp04/unpackage/dist/dev/mp-alipay/pages/forums/forums.axml
vendored
Normal file
1
uniapp04/unpackage/dist/dev/mp-alipay/pages/forums/forums.axml
vendored
Normal file
@ -0,0 +1 @@
|
||||
<view class="cart-page"><view a:for="{{a}}" a:for-item="item" a:key="d"><view>{{item.a}} - {{item.b}}元</view><button onTap="{{item.c}}">+</button></view><view a:if="{{b}}"><view>购物车中的商品:</view><view a:for="{{c}}" a:for-item="cartItem" a:key="d">{{cartItem.a}} - {{cartItem.b}}元 <button onTap="{{cartItem.c}}">-</button></view></view></view>
|
45
uniapp04/unpackage/dist/dev/mp-alipay/pages/forums/forums.js
vendored
Normal file
45
uniapp04/unpackage/dist/dev/mp-alipay/pages/forums/forums.js
vendored
Normal 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)),
|
||||
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)),
|
||||
d: cartIndex
|
||||
};
|
||||
})
|
||||
} : {});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
my.createPage(MiniProgramPage);
|
6
uniapp04/unpackage/dist/dev/mp-alipay/pages/forums/forums.json
vendored
Normal file
6
uniapp04/unpackage/dist/dev/mp-alipay/pages/forums/forums.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"defaultTitle": "学生中心",
|
||||
"pullRefresh": false,
|
||||
"titleBarColor": "#4095e5",
|
||||
"usingComponents": {}
|
||||
}
|
Reference in New Issue
Block a user