继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

【金秋打卡】第11天 全新升级,基于Vue3新标准,打造后台综合解决方案 第十一讲

ToRAmen
关注TA
已关注
手记 77
粉丝 10
获赞 5

课程章节: 项目发布解决方案之构建与发布

主讲老师: Sunday

课程内容:

今天学习的内容包括:

如何进行项目发布

课程收获:

11.1 心得:

"use strict";
Component({
    properties: {
        list: {
            type: Array,
            value: [],
            observer: "onListChange"
        },        
    },


    data: {
    },


    methods: {

        onListChange: function onListChange() {
            this.setData({
                list: this.data.list,
            });

        },

        /**
         * 点击Item
         * @param {*} e 
         */
        onClickItem: function onClickItem(e) {
            let data = e.currentTarget.dataset.item;
            this.triggerEvent('onClickItem', data);
        },


        /**
         * 点击清除历史
         * @param {*} e 
         */
        onClickClear: function onClickClear(e) {
            this.triggerEvent('onClickClearHistory', {});
        },
        

    }
});
.container,.history_item_container,.clear_history_container {
  display: flex;
  background-color: #fff;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.container {
  flex-direction: column;
}

.history_item_container{
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 30rpx 0;
  margin: 0 32rpx;
  border-bottom: 1rpx solid #F6F6F6;
}

.clear_history_container{
  justify-content: center;
  align-items: center;
  padding: 30rpx 0;
}

.right_arrow{
  width: 15rpx;
  height: 25rpx;
  flex-shrink: 0;
  margin-left: 10rpx;
  margin-right: 10rpx;
}

.history_item_content,.cleart_text{
  line-height: 34rpx;
  font-size: 24rpx;
  flex-shrink: 0;
  text-align: center;
  color: #333333;
}

.clear{
  width: 25rpx;
  height: 24rpx;
  flex-shrink: 0;
  margin-left: 10rpx;
  margin-right: 10rpx;
}
<view class="container">
  <block wx:if="{{list !== null && list.length !== 0}}">
    <block wx:for="{{list}}" wx:for-item="item" wx:key="{{index}}">
      <view class="history_item_container" data-item="{{item}}" bindtap="onClickItem">
        <view class="history_item_content">{{item}}</view>
        <image class="right_arrow" src="{{'/images/ic_right_gray_arrow.png'}}" />
      </view>
    </block>
    <view class="clear_history_container" bindtap="onClickClear">
      <image class="clear" src="{{'/images/ic_search_delete.png'}}" />
      <view class="cleart_text">清空搜索记录</view>
    </view>
  </block>

</view>
{
    "component": true,
    "componentGenerics": {
        "list-item": true
    }
}

图片描述

打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP