移動端 ionic angularjs列表和單選以及多選框混合使用問題
阿新 • • 發佈:2019-01-30
第一次使用ionic,需要展現一個列表,列表下面是輸入框或者多選、單選。就是一張問卷
想的是先展現題目列表,每個題目裡面巢狀多選、單選或者輸入框,結果不行。不知道是什麼原因,是列表禁用了點選功能還是什麼(如有知道的,請給小弟解惑啊)?
程式碼:
<html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <style type="text/css"> body { cursor: url('http://www.runoob.com/try/demo_source/finger.png'), auto; } </style> </head> <body> <ion-header-bar class="bar-positive"> <div class="buttons"><button class="button" ng-click="modalCancel()">返回</button></div> <h1 class="title">{{sfs.name}}</h1> <div class="buttons"><button class="button" ng-click="modalConfirm()" style="text-align: left;" ng-disabled="">提交</button></div> </ion-header-bar> <ion-content>
<div class="list">
<div ng-repeat="item in sfs.surveyItems" style="overflow: auto;" class="item item-button-right">
標紅的2行紅色是現在的,效果可以點選<h2 class="calm" style="margin-bottom:10px;font-size:14px;"> <div class="item item-divider"> {{$index+1}}、{{item.itemName}} <span ng-if="item.answerType==1">(單選)</span> <span ng-if="item.answerType==2">(多選)</span> <span ng-if="item.answerType==3">(問答)</span> </div> </h2> <div ng-if="item.answerType==1"> <ion-radio ng-repeat="answer in item.answers" ng-value="answer.num" ng-click="radioAnswer(item,answer,$event)">{{answer.answer}}</ion-radio> </div> <div ng-if="item.answerType==2"> <ion-checkbox ng-repeat="answer in item.answers" ng-click="checkAnswer(item,answer,$event)">{{answer.answer}}</ion-checkbox> </div> <div ng-if="item.answerType==3"> <label class="item item-input"> <textarea placeholder="最長100個字元" maxlength="100" ng-keyup="disparkAnswer(item,$event)"></textarea> </label> </div> </div> </div> </ion-content> </body> </html>
最開始用的是
<ion-list show-delete="data.showDelete" show-reorder="data.showReorder">
<ion-item ng-repeat="item in items"
item="item"
href="#/item/{{item.id}}" class="item-remove-animate">
Item {{ item.id }}
這個就無法點選勾選
如有知道原因的還望告知