小程序 自定义 时间轴组件

image.png

新鲜出炉 自定义时间轴组件 拿过去用吧!
timeAxis.js


Component({
  options: {
    multipleSlots: true
  },

  properties: {
    isCurent:{
      type: Boolean,
      value: false
    },
    isShowLeftLine: {
      type: Boolean,
      value: true
    },
    axisTitle: {
      type: String,
      value: ''
    },
    axisTime:{
      type: String,
      value: ''
    },
    textArray:{
      type: Array,
      value:[]
    }

  },

  data: {
   
  },
  ready() {
    console.log(  this.data.textArray)
  },

  methods: {

  }
})

timeAxis.wxml





<view class='itemTimeZ'>
 <!--  左边 -->
<view class='leftView'>
<view class='{{isCurent===true?"roundVIew":"outRoundVIew"}}'></view>
<view wx:if="{{isShowLeftLine}}" class='leftLine'>
</view>
</view>

<!-- 右边 -->
<view class='rightContent'>
  <slot name="rightChilren"></slot>
<block wx:if="{{textArray.length>0}}">
  <text wx:for="{{textArray}}" wx:key="unique" class='{{isCurent === true? "curentTitle" : "outTitle"}}'>{{item}}</text>
</block>
  <text wx:if="{{axisTitle!=''}}" class='{{isCurent === true? "curentTitle" : "outTitle"}}'>{{axisTitle}}</text>
  <text class='{{isCurent === true? "curentTime" : "outTime"}}'>{{axisTime}}</text>
</view>



</view>



timeAxis.wxss



.itemTimeZ{
  display: flex;
  flex:1;
  padding:0px 15px 0 15px;
}
.leftView{
  display: flex;
  flex-direction: column;
 

  
}
.roundVIew{
  width: 9px;
  height: 9px;
  border-radius: 4.5px;
  background: red;
}
.outRoundVIew{
  width: 9px;
  height: 9px;
  border-radius: 4.5px;
  background: #999;
}
.leftLine{
  display: flex;
  flex: 1;
  width: 1px;
  margin-left: 3.5px;
  padding-bottom: 6px;
  background: #DADADA;
}

.rightContent{
  display: flex;
  flex:1;
  flex-direction: column;
  margin-top: -6px;
  margin-left: 15px;
  padding-bottom: 24px;

}

.curentTitle{
  font-size: 16px;
  line-height: 22.5px;
  color:#fe473c
}
.curentTime{
  font-size: 14px;
  color:#fe473c
}
.outTitle{
  font-size: 16px;
    line-height: 22.5px;
  color:#999
}
.outTime{
  font-size: 14px;
  color:#999
}

用法:

<view class='timeAxisView'> 
<timeAxis isCurent="{{true}}" axisTitle="取消退货" axisTime="2019-05-21 21:09:09"/>
<timeAxis axisTitle="买家修改申请" axisTime="2019-05-21 21:09:09"/>
<timeAxis textArray="{{textArray}}" axisTime="2019-05-21 21:09:09"/>
<timeAxis axisTitle="买家修改退货" axisTime="2019-05-21 21:09:09" isShowLeftLine="{{false}}"/>
</view>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 前言 微信小程序自1月19号发布后,可谓是有人欢喜有人忧啊.曾经对它一度抱有各种期待的前端工作者们在张总的一句句:...
    你为什么无理取闹阅读 800评论 0 1
  • 前言 微信小程序自1月19号发布后,可谓是有人欢喜有人忧啊.曾经对它一度抱有各种期待的前端工作者们在张总的一句句:...
    LinDaiDai_霖呆呆阅读 6,204评论 6 11
  • 好吧,突然发现学不完了,一下子,那就分开吧,由于时间太久,直接重新大致复习了一下 微信小程序自定义组件微信小程序支...
    小小小8021阅读 2,630评论 0 9
  • 一个好故事往往需要开很大的脑洞,尤其是幻想类的作品,科幻,奇幻之类。《妖猫传》开了一个脑洞,关于历史上说的杨贵妃死...
    此胖非胖阅读 678评论 0 0
  • 结缘脑图是今年的7月底,在北京参加讲师大赛,看到营养师谢莉用脑图讲营养知识,一下子就被吸引住了,彩色的图描绘着的曲...
    张晓蓉营养师阅读 547评论 2 0