在我的xml文件的特定位置,我有这个:
<GridLayout row="2" rowSpan="2" col="2" rows="*" columns="40,*,40" verticalAlignment="center" horizontalAlignment="right" marginRight="10">
<Label row="0" col="0" text="+" tap="onTapPlus" verticalAlignment="center" horizontalAlignment="center" style="color:black;font-family: 'Allerta Stencil', sans-serif;font-size:20px;"></Label>
<Label id="" row="0" col="1" text="{{nrItemsTakeAway}}" verticalAlignment="center" horizontalAlignment="center" style="color:black;font-family: 'Allerta Stencil', sans-serif;font-size:20px;text-align:center; width:50px;"></Label>
<Label row="0" col="2" text="-" tap="onTapMinus" verticalAlignment="center" horizontalAlignment="center" style="color:black;font-family: 'Allerta Stencil', sans-serif;font-size:20px;"></Label>
</GridLayout>
因此,当用户点击+按钮时,onTapPlus函数将被调用,并且nrItemsTakeAway应该会增加...因此仅出于测试目的,我在onTapPlus函数中做到了这一点:
function onTapPlus(args) {
const button = args.object;
const page = button.page;
vm.set("nrItemsTakeAway", "4");
page.bindingContext = vm;
但是它不起作用...它没有约束力,我在这里想念什么?
谢谢您的时间。