item.choose=!item.choose不合法吗?
时间: 2024-06-05 19:11:28 浏览: 30
在大多数编程语言中,`!`符号代表逻辑非运算符,用于将布尔值取反。因此,`!item.choose`表示`item.choose`的逻辑反值,即`item.choose`为`false`时为`true`,`item.choose`为`true`时为`false`。
在一些语言中,`!`符号不能直接应用于非布尔类型的值。因此,如果`item.choose`是一个非布尔类型的值,那么`!item.choose`可能不合法。具体情况需要根据编程语言和数据类型来确定。
相关问题
<select id="selectAll" resultMap="tblTicketCardDistributionMap"> select * from TBL_TICKET_CARD_DISTRIBUTION <where> <choose> <when test="query.orderType != null and query.orderType != '' and query.orderType =='03'"> and ORDER_TYPE = #{query.orderType} and ( <if test="query.inStationId != null and query.inStationId != '' "> IN_STATION_ID = #{query.inStationId} </if> <if test="query.outStationId != null and query.outStationId != '' "> or OUT_STATION_ID = #{query.outStationId} </if> ) </when> <otherwise> <if test="query.orderType != null and query.orderType != '' "> and ORDER_TYPE = #{query.orderType} </if> <if test="query.inStationId != null and query.inStationId != '' "> and IN_STATION_ID = #{query.inStationId} </if> <if test="query.outStationId != null and query.outStationId != '' "> or OUT_STATION_ID = #{query.outStationId} </if> </otherwise> </choose> <if test="query.lineId != null and query.lineId != '' "> and LINE_ID = #{query.lineId} </if> <if test="query.stationId != null and query.stationId != '' "> and STATION_ID = #{query.stationId} </if> <if test="query.operatorId != null and query.operatorId != '' "> and OPERATOR_ID = #{query.operatorId} </if> <if test="query.curDay != null and query.curDay != '' "> and CUR_DAY = #{query.curDay} </if> <if test="query.beginTime != null and query.beginTime != '' "> and OPERATE_TIME between #{query.beginTime} and #{query.endTime} </if> </where> </select>报错语法有问题,修改正确的
根据报错信息,需要看一下具体是哪个语法有问题。不过根据代码,有一个语法问题:
在`<when>`标签中,使用了`<if>`标签,应该改为`${}`,例如:
```
<when test="query.orderType != null and query.orderType != '' and query.orderType =='03'">
and ORDER_TYPE = #{query.orderType} and (
${query.inStationId != null and query.inStationId != '' ? 'IN_STATION_ID = #{query.inStationId}' : ''}
${query.outStationId != null and query.outStationId != '' ? ' or OUT_STATION_ID = #{query.outStationId}' : ''}
)
</when>
```
这样应该就能解决语法问题了。
<view class="answer-list"> <view class="answer" wx:for="{{curQuestion.answerList}}" wx:key="index" bindtap="answerClick" data-index="{{index}}"> <view style="background:{{curQuestion.answerFlag && item.realFlag?'#1CC18D':(curQuestion.answerFlag && !item.realFlag && curQuestion.curIndex == index ? '#FA6C6C':'#fff')}};color:{{curQuestion.answerFlag && (item.realFlag || curQuestion.curIndex == index)?'#fff':'#000'}}" class="answer-item"> {{item.name}}</view> <view class="icon-box" wx:if="{{curQuestion.answerFlag && (item.realFlag || curQuestion.curIndex == index)}}"> <text wx:if="{{curQuestion.answerFlag && !item.realFlag && curQuestion.curIndex == index}}" class="cuIcon-roundclosefill choose-fail"></text> <text wx:if="{{curQuestion.answerFlag && item.realFlag}}" class="cuIcon-roundcheckfill choose-success"></text> </view> </view> </view> 转uniapp写法
<view class="answer-list">
<view class="answer" v-for="(item, index) in curQuestion.answerList" :key="index" @tap="answerClick" :data-index="index">
<view :style="{background: curQuestion.answerFlag && item.realFlag ? '#1CC18D' : (curQuestion.answerFlag && !item.realFlag && curQuestion.curIndex == index ? '#FA6C6C' : '#fff'), color: curQuestion.answerFlag && (item.realFlag || curQuestion.curIndex == index) ? '#fff' : '#000'}" class="answer-item">
{{item.name}}
</view>
<view class="icon-box" v-if="curQuestion.answerFlag && (item.realFlag || curQuestion.curIndex == index)">
<text v-if="curQuestion.answerFlag && !item.realFlag && curQuestion.curIndex == index" class="cuIcon-roundclosefill choose-fail"></text>
<text v-if="curQuestion.answerFlag && item.realFlag" class="cuIcon-roundcheckfill choose-success"></text>
</view>
</view>
</view>