實際上我做了一個 html 頁面,其中有兩個部分,當我點擊第一部分時,數字會增加,當我點擊第二部分時,第二部分的數字會增加。我為此使用了 Angular JS?,F在我在每個頁面的底部做了一個按鈕。我希望當我點擊那個按鈕時,數字應該減少,但是當我點擊按鈕時我使用了這個功能,它只減少了一次。如果您有進一步的查詢如何使用函數減少值, 我在這里有更詳細的信息<button type="button" ng-click="delPoint(1)" id="sub1" style="position: absolute;bottom: 0;left: 10px;font-size: 50px;color: white;font-weight:bolder; margin: 0px !important;cursor: pointer;">-</button><button type="button" ng-click="delPoint(2)" id="sub2" style="position: absolute;bottom: 0;right: 10px;font-size: 50px;color: white;font-weight:bolder; margin: 0px !important;cursor: pointer;">-</button>$scope.delPoint = function (j) { if ($scope.team1.score > 0 && $scope.team2.score >0){ $scope['team' + j].score--; $scope.gameInfo.servesSinceSwitch--; }
不斷遞減函數值
LEATH
2021-10-14 17:07:46