<template>
  <div class="picker-wrap">
    <div
      class="picker-wrap-txt"
      :class="{ placeholder: !String(pickerValShow) }"
      @click="show = true"
    >
      <span>{{ pickerValShow || placeholder }}</span>
      <svg-icon icon-class="triangle-right" slot="button" />
    </div>
    <cr-popup v-model="show" position="bottom" get-container="body">
      <cr-date-picker ref="datepicker" @confirm="onConfirm" @cancel="onCancel" />
    </cr-popup>
  </div>
</template>

<script>
import popupPickerMixin from "../mixins/popupPicker.mixin.js";
export default {
  name: "PopupDatePicker",
  mixins: [popupPickerMixin],
  data() {
    return {
      refName: "datepicker"
    };
  },
  methods: {
    handleResult(res) {
      this.pickerValShow = res;
      this.pickerVal = res;
    }
  }
};
</script>
<style lang="less">
.picker-wrap {
  width: 100%;
  &-txt {
    height: 24px;
    color: #333;
    font-size: 14px;
  }
  .svg-icon {
    height: 16px;
    width: 16px;
  }
  .placeholder {
    color: #ccc;
  }
}
</style>
