帖子
帖子
用户
博客
课程
显示全部楼层
21
帖子
0
勋章
93
Y币

[多端开发] stml文件中单行冒号“:”的作用是什么?

[复制链接]
发表于 2021-10-30 11:01:56
各位大神
多多指教。
在模板文件中看到,
stml文件中,冒号占一行,
有什么作用或意义吗?

380
帖子
4
勋章
6
Y币
哪冒号占一行?
21
帖子
0
勋章
93
Y币
   {api.systemType==='android'?   
   
    <view class="a-tabs">

      <scroll-view class="a-tabs__nav"  scroll-x
            style="flex-flow: row nowrap;flex-shrink: 0;justify-content: center;">
        <view class="a-tabs__nav--item" onClick={this.handleNavClick.bind(this,index)}
              style="flex:1;height: 44px;justify-content: center;align-items: center;margin:0px 8px 0px 0px;"
              v-for="(it,index) in course_category">
          <text :class="'a-tabs__nav-text'
            + (index===this.data.tabsParam.current?' a-tabs__nav-text---active':'')">
            {it.name}
          </text>
          <view :class="index===this.data.tabsParam.current?'a-tabs__nav--line-active':'a-tabs__nav--line'"></view>
        </view>
      </scroll-view>

      <list-view id="listView" class="main" enable-back-to-top onscrolltolower={this.onscrolltolower} style="margin:100px 5px 15px 20px;">
        <cell @click="itemClick">
          <view class="course-tabs__item--list__item" style="margin:20px 5px 15px 20px;">
            <img _slot="content" class="course-tabs__item--list__item--cover" style="margin:20px 5px 15px 20px;" :src="item.cover"/>
            <view _slot="footer" class="course-item__footer a-card__footer" style="margin:100px 5px 15px 20px;">
              <view class="course-item__info" style="margin:20px 5px 15px 20px;">
                <text class="course-item__info--title"  style="margin:20px 5px 15px 20px;">{{ item.title }}</text>
                <text class="course-item__info--price"  style="margin:20px 5px 15px 20px;">{{ item.class_hour + '工时 / ' }}</text>
                <text class="course-item__info--price"  style="margin:20px 5px 15px 20px;">{{ item.price + '元' }}</text>
              </view>
               <text class="course-tabs__item--list__item--introduction"  style="margin:20px 5px 15px 20px;">{{ item.introduction }}</text>
            </view>
          </view>
        </cell>
      </list-view>

      { this.data.dataList[tabsParam.current]==='-'&&
      <b-notice title="正在加载中" icon="../../images/icon__notice--loading.gif"/>
      }
      { this.data.dataList[tabsParam.current].length===0&&
      <b-notice title="暂无数据哦" icon="../../images/icon__notice--empty.png"/>
      }

    </view>
  
    :
  
   
    <a-tabs class="course-tabs" :param="tabsParam" onChange="tabChange">
      <a-tab class="course-tabs__item" :title="it.name"
        style="flex:1;height: 44px;align-items: center;margin:0px 5px 0px 0px;"
        v-for="it in course_category">
        {this.data.dataList[tabsParam.current]==='-'?
        <b-notice title="正在加载中" icon="../../images/icon__notice--loading.gif"/>
        <!-- : -->
        :
        (
        this.data.dataList[tabsParam.current].length?
        <view class="course-tabs__item--list">
          <a-card v-for="item in dataList[tabsParam.current]" class="course-tabs__item--list__item"
                  @click="goto(item)">
            <img _slot="content" class="course-tabs__item--list__item--cover" :src="item.cover"/>
            <view _slot="footer" class="course-item__footer">
              <view class="course-item__info">
                <text class="course-item__info--title">{{ item.title }}</text>
                <text class="course-item__info--price">{{ '参考:'+item.class_hour }}工时/{{ item.price }}元</text>
              </view>
              <!--<text class="course-tabs__item--list__item--introduction">{{ item.introduction }}</text>-->
            </view>
          </a-card>
        </view>
        <!-- : -->
        :
        <b-notice title="暂无数据哦" icon="../../images/icon__notice--empty.png"/>
        )}
      </a-tab>
    </a-tabs>
    <!--  安卓判断-->
    }
21
帖子
0
勋章
93
Y币
标红色的冒号
10
帖子
1
勋章
5683
Y币
应该是jsx中条件表达式

jsx是支持 js代码:

( true ? <text>真</text> : <text>假</text>)
21
帖子
0
勋章
93
Y币
明白了,多谢了
您需要登录后才可以回帖 登录

本版积分规则