vue elementui 日期datetimerange
1.template中:<el-col :xs="24" :sm="24" :md="24" :lg="10" :xl="8"><div class="pub_input_content"><span class="pub_input_title pub_input_title_data"&...
·
1.template中:
<el-col :xs="24" :sm="24" :md="24" :lg="10" :xl="8">
<div class="pub_input_content">
<span class="pub_input_title pub_input_title_data">创建时间</span>
<el-date-picker
v-model="searchData.create_time"
value-format="yyyy-MM-dd HH:mm:ss"
class="pub_input_input pub_input_data"
type="datetimerange"
clearable
@change="dateChangebirthday"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</div>
</el-col>
2.data中:
// 搜索内容
searchData: {
list_type: '1',
create_time: '', // 日期
date: ''
},
3.methods中:
dateChangebirthday (val) {
this.searchData.create_time = val
},
//获取数据方法中:
if (this.searchData.create_time !== '' || this.searchData.create_time !== null) {
const timeData = `${this.searchData.create_time[0]} - ${this.searchData.create_time[1]}`
this.searchData.date = timeData
} else {
this.searchData.date = ''
}
const data = {
list_type: this.searchData.list_type,
create_time: this.searchData.date,
page: this.page.currentPage,
per_page: this.page.pageSize
}
更多推荐
已为社区贡献2条内容
所有评论(0)