elementui 開始結(jié)束時間可以選擇同一天不同時間段的實現(xiàn)代碼
更新時間:2024年02月02日 11:32:26 作者:rosener
這篇文章主要介紹了elementui 開始結(jié)束時間可以選擇同一天不同時間段的實現(xiàn)代碼,需要先在main.js中導(dǎo)入相應(yīng)代碼,代碼簡單易懂,需要的朋友可以參考下
elementui 開始結(jié)束時間可以選擇同一天不同時間段
import moment from 'moment' <el-row> <el-col :span="12"> <el-form-item label="考試開始時間" prop="startTime"> <el-date-picker v-model="shiJuanXinXiForm.startTime" style="width: 100%" type="datetime" start-placeholder="開始時間" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss" @change="changeStartEnd('start', $event)"></el-date-picker> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="考試結(jié)束時間" prop="endTime"> <el-date-picker v-model="shiJuanXinXiForm.endTime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss" style="width: 100%" type="datetime" start-placeholder="結(jié)束時間" :picker-options="pickerOptions" @change="changeStartEnd('end', $event)"></el-date-picker> </el-form-item> </el-col> </el-row> methods: { changeStartEnd(type, val) { debugger if (type === "start") { this.shiJuanXinXiForm.endTime = val } }, } computed: { isVisible: { get() { return this.dialogVisible; }, set() { this.close(); this.reset(); }, }, title() { return this.$t("common." + this.type); }, pickerOptions() { let str = ""; if(this.$moment(this.shiJuanXinXiForm.startTime).format("YYYY-MM-DD") === this.$moment(this.shiJuanXinXiForm.endTime).format("YYYY-MM-DD")){ str = this.shiJuanXinXiForm.startTime.split(" ").at(-1) }else{ str = "00:00:00" } return { disabledDate: (time) => { return new Date(this.shiJuanXinXiForm.startTime).getTime() > time.getTime(); }, selectableRange: str + " - 23:59:59" } }, },
到此這篇關(guān)于elementui 開始結(jié)束時間可以選擇同一天不同時間段的文章就介紹到這了,更多相關(guān)elementui 開始結(jié)束時間內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
解決vue中使用swiper插件問題及swiper在vue中的用法
Swiper是純javascript打造的滑動特效插件,面向手機、平板電腦等移動終端。這篇文章主要介紹了解決vue中使用swiper插件及swiper在vue中的用法,需要的朋友可以參考下2018-04-04關(guān)于vuejs中v-if和v-show的區(qū)別及v-show不起作用問題
v-if 有更高的切換開銷,而 v-show 有更高的出事渲染開銷.因此,如果需要非常頻繁的切換,那么使用v-show好一點;如果在運行時條件不太可能改變,則使用v-if 好點2018-03-03如何在Vue3和Vite項目中用SQLite數(shù)據(jù)庫進行數(shù)據(jù)存儲
SQLite是一種嵌入式關(guān)系型數(shù)據(jù)庫管理系統(tǒng),是一個零配置、無服務(wù)器的、自給自足的、事務(wù)性的SQL數(shù)據(jù)庫引擎,這篇文章主要給大家介紹了關(guān)于如何在Vue3和Vite項目中用SQLite數(shù)據(jù)庫進行數(shù)據(jù)存儲的相關(guān)資料,需要的朋友可以參考下2024-03-03基于vue-simplemde實現(xiàn)圖片拖拽、粘貼功能
這篇文章主要介紹了基于vue-simplemde實現(xiàn)圖片拖拽、粘貼功能,需要的朋友可以參考下2018-04-04