dateScreen.wxml 2.31 KB
<!--components/dateScreen/dateScreen.wxml-->
<view class="date-screen">
	<view class="tab-section {{ isSticky ? 'isSticky' : '' }}"
	      style="background: {{ customBackground }};"
	      wx:if="{{ !tabSelected || tabSelected == 3 }}">
		<block wx:for="{{ dateList }}" wx:key="index">
			<view class="tab {{ item.index==dateCurrent?'active':'' }}"
			      data-index="{{ item.index }}"
			      bind:tap="selectDate">
				{{ item.title }}
			</view>
		</block>
	</view>
	<view class="date-section">
		<view class="arrow left">
			<van-icon wx:if="{{ !leftCurrent }}"
			          class="arrow-left"
			          name="arrow-left"
			          bind:tap="last" />
		</view>
		<view class="date-text" bind:tap="onDisplayDate">
			{{ date }}
		</view>
		<view class="arrow right">
			<van-icon wx:if="{{ !rightCurrent }}"
			          class="arrow-right"
			          name="arrow"
			          bind:tap="next" />
		</view>
	</view>
</view>
<!-- 年月日 -->
<block wx:if="{{ dateShow }}">
	<popup bindcancel="cancel"
	       bindconfirm="confirm"
	       show="{{ dateShow }}"
	       title="{{ titleEnum[timeType] }}"
	       height="60vh">
		<block wx:if="{{ timeType == 'date' || timeType == 'year-month' }}">
			<van-datetime-picker id="datePicker"
			                     show-toolbar="{{ false }}"
			                     min-date="{{ minDate }}"
			                     max-date="{{ maxDate }}"
			                     model:value="{{ currentDate }}"
			                     type="{{ timeType=='date'?'date':'year-month' }}"
			                     bind:change="onChange"
			                     bind:input="onInput" />
		</block>
		<!-- 周 -->
		<block wx:if="{{ timeType == 'week' }}">
			<van-picker id="weekPicker"
			            show-toolbar="{{ false }}"
			            model:value="{{ currentDate }}"
			            default-index="{{ defaultIndex }}"
			            value-key="label"
			            columns="{{ weekColumns }}"
			            bind:change="onWeekChange" />
		</block>
	</popup>
</block>
<block wx:if="{{ show }}">
	<van-calendar id="calendar"
	              max-range="{{ 31 }}"
	              min-date="{{ minDate }}"
	              max-date="{{ maxDate }}"
	              show="{{ show }}"
	              type="range"
	              color="#2C66F7"
	              bind:confirm="onConfirm"
	              bind:close="onClose" />
</block>