<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 你就知道結果了