XhTime.vue 1.59 KB
<!-- *******************  输入框  *******************  -->
<template>
  <view class="picker-box">
    <!-- <view class="u-flex u-row-between" @click="openPicker">
			<view class="txt u-flex-1">{{dataValue||'请选择时间'}}</view>
			<u-icon name="arrow-right" color="#666" size="28"></u-icon>
		</view> -->
    <!-- <u-picker :params="params" v-model="showPicker" mode="time" @confirm="pickerConfirm"></u-picker> -->
    <view class="u-flex u-row-between">
      <picker
        mode="date"
        :value="dataValue"
        @change="bindDateChange"
        class="txt u-flex-1"
        :disabled="disabled"
      >
        <view>{{ dataValue || '请选择时间' }}</view>
      </picker>
      <u-icon name="arrow-right" color="#666" size="28"></u-icon>
    </view>
  </view>
</template>

<script>
import stringMixin from './stringMixin'
export default {
  components: {},
  mixins: [stringMixin],
  props: {},
  data() {
    return {
      showPicker: false,
      params: {
        year: true,
        month: true,
        day: true,
        hour: false,
        minute: false,
        second: false,
        timestamp: true,
      },
      date: '请选择',
    }
  },
  mounted() {},
  methods: {
    openPicker() {
      this.showPicker = true
    },
    pickerConfirm(data) {
      let result = []
      let dataValue = data.year + '-' + data.month + '-' + data.day
      this.dataValue = dataValue
      this.valueChange(dataValue)
    },
    bindDateChange: function(e) {
      const value = e.target.value
      this.dataValue = value
      this.valueChange(value)
    },
  },
}
</script>

<style></style>