vue+ElementUI 日期选择器 获取时间戳

 <div class="block">
    <span class="demonstration">daterange</span>
    <el-date-picker
      v-model="value9"
      type="daterange"
      start-placeholder="开始日期"
      end-placeholder="结束日期"
      :default-time = "['00:00:00','23:59:59']"
      value-format="timestamp">
    </el-date-picker>
     <el-button type="primary" @click="search">主要按钮</el-button>
  </div>
在data里面写value9:''  v-model 了嘛
 

上面是从ElementUI里面粘过来的

:default-time  作用是 限定你选择的时间范围吧  如果你选择5月1日至5月2日 默认 传回来的一个是5月1日 00:00:00 ,另一个是5月2日 00:00:00  不知道是不是我骚错了

value-formate="timestamp"  加上这个属性的作用是 将返回你选择的日期的时间戳

获取选择的时间戳 直接 value9  你就知道结果了

猜你喜欢

转载自www.cnblogs.com/TreeCTJ/p/10909233.html