<el-form :inline="true" :rules="dataRules" label-width="140px" ref="dataForm" :model="dataForm" label-position="right"> <el-row> <el-form-item prop="dataDate" class="search-card" label="数据日期"> <el-date-picker v-model="dataForm.dataDate" type="date" value-format="yyyy-MM-dd" class="dateInput" @change="dataDateChange" clearable ></el-date-picker> </el-form-item> </el-row> <el-row> <el-col :span="24"> <el-form-item prop="week" label="星期"> <el-select class="formFrame" v-model="dataForm.week" disabled> </el-select> </el-form-item> </el-col> </el-row>
JS
代码
weeks: { "0":'星期日', "1":'星期一', "2":'星期二', "3":'星期三', "4":'星期四', "5":'星期五', "6":'星期六', },
//根据当前的日期显示当前是星期几 dataDateChange(dateStr){ let date = new Date(dateStr); let weekIndex = date.getDay(); this.dataForm.week = this.weeks[weekIndex];
版权声明:本文为candybaby1223原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。