欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Vue實現點擊時間獲取時間段查詢功能

 更新時間:2021年08月31日 15:28:11   作者:cdx1170776994  
這篇文章主要為大家詳細介紹了Vue實現點擊時間獲取時間段查詢功能,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了vue按時間段查詢的案例,效果圖如下

html代碼

<template>
<div class="personalReport_time">
  <input type="date" :max="this.endTime" value="" v-model="startTime"/>
  <div></div>
  <input type="date" :min="startTime" :max="this.maxTime" v-model="endTime"/>
 </div>
 <ul class="personalReport_date">
  <li @click="query('today')">今天</li>
  <li @click="query('yesterday')">昨天</li>
  <li @click="query('weeks')">本周</li>
  <li @click="query('lastWeek')">上周</li>
  <li @click="query('month')">本月</li>
  <li @click="query('lastMonth')">上月</li>
 </ul>
 <div>
  <button @click="query" class="but">查詢</button>
 </div>
 </template>

vue.js代碼 點擊事件

//獲取時間、
//時間解析;
 Time:function(now) {
 let year=new Date(now).getFullYear();
 let month=new Date(now).getMonth()+1;
 let date=new Date(now).getDate();
 if (month < 10) month = "0" + month;
 if (date < 10) date = "0" + date;
 return year+"-"+month+"-"+date
 },
 //本周第一天;
 showWeekFirstDay:function()
 {
 let Nowdate=new Date();
 let WeekFirstDay=new Date(Nowdate-(Nowdate.getDay()-1)*86400000);
 let M=Number(WeekFirstDay.getMonth())+1;
 if(M<10){
  M="0"+M;
 }
 let D=WeekFirstDay.getDate();
 if(D<10){
  D="0"+D;
 }
 return WeekFirstDay.getFullYear()+"-"+M+"-"+D;
 },
 //本周最后一天
 showWeekLastDay:function ()
 {
 let Nowdate=new Date();
 let WeekFirstDay=new Date(Nowdate-(Nowdate.getDay()-1)*86400000);
 let WeekLastDay=new Date((WeekFirstDay/1000+6*86400)*1000);
 let M=Number(WeekLastDay.getMonth())+1;
 if(M<10){
  M="0"+M;
 }
 let D=WeekLastDay.getDate();
 if(D<10){
  D="0"+D;
 }
 return WeekLastDay.getFullYear()+"-"+M+"-"+D;
 },
 //獲得某月的天數:
 getMonthDays:function (myMonth){
 let monthStartDate = new Date(new Date().getFullYear(), myMonth, 1);
 let monthEndDate = new Date(new Date().getFullYear(), myMonth + 1, 1);
 let days = (monthEndDate - monthStartDate)/(1000 * 60 * 60 * 24);
 return days;
 },
//點擊事件
query:function (way) {
  let self=this;
  this.$refs.pag.currentPage=1;
  this.page=this.$refs.pag.currentPage;
  switch (way){
  case 'today':
   this.startTime=this.maxTime;
   this.endTime=this.maxTime;
   break;
  case 'yesterday':
   this.startTime=this.Time(new Date().getTime()-24*60*60*1000);
   this.endTime=this.Time(new Date().getTime()-24*60*60*1000);
   break;
  case 'weeks':
   this.startTime=this.showWeekFirstDay();
   this.endTime=this.maxTime;
   break;
  case 'lastWeek':
   this.startTime=this.Time(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()-new Date().getDay()-6));
   this.endTime=this.Time(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()+(6-new Date().getDay()-6)));
   break;
  case 'month':
   this.startTime=this.Time(new Date(new Date().getFullYear(), new Date().getMonth(),1));
   this.endTime=this.maxTime;
   break;
  case 'lastMonth':
   this.startTime=this.Time(new Date(new Date().getFullYear(),new Date().getMonth()-1,1));
   this.endTime=this.Time(new Date(new Date().getFullYear(),new Date().getMonth()-1,this.getMonthDays(new Date().getMonth()-1)));
   break;
  }
  this.$axios({
  method:'post',
  url:'/inter/user/queryMemberReport',
  data:{
   'account':this.account,
   'baseLotteryId':this.lottersId,
   'startTime':this.startTime,
   'endTime':this.endTime
  }
  }).then(function (data) {
//  console.log(data)
  }).catch(function (error) {
  console.log(error);
  })
 }

這樣一個點擊查詢時間段效果就可以實現了。

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關文章

  • Element-UI表格嵌入popover遇到的問題及解決方案

    Element-UI表格嵌入popover遇到的問題及解決方案

    在表格中我們通常需要在每一行的一些單元格中顯示popover,這篇文章主要給大家介紹了關于Element-UI表格嵌入popover遇到的問題及解決方案,需要的朋友可以參考下
    2023-11-11
  • Vue3?路由頁面切換動畫?animate.css效果

    Vue3?路由頁面切換動畫?animate.css效果

    這篇文章主要介紹了Vue3路由頁面切換動畫animate.css效果,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2023-09-09
  • vue input輸入框關鍵字篩選檢索列表數據展示

    vue input輸入框關鍵字篩選檢索列表數據展示

    這篇文章主要為大家詳細介紹了vue input輸入框關鍵字篩選檢索列表數據展示,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-05-05
  • 使用websocket和Vue2中的props實時更新數據方式

    使用websocket和Vue2中的props實時更新數據方式

    這篇文章主要介紹了使用websocket和Vue2中的props實時更新數據方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-08-08
  • 基于Vue2.0+ElementUI實現表格翻頁功能

    基于Vue2.0+ElementUI實現表格翻頁功能

    Element UI 是一套采用 Vue 2.0 作為基礎框架實現的組件庫,它面向企業(yè)級的后臺應用,能夠幫助你快速地搭建網站,極大地減少研發(fā)的人力與時間成本。這篇文章主要介紹了Vue2.0+ElementUI實現表格翻頁功能,需要的朋友可以參考下
    2017-10-10
  • vue-cli2與vue-cli3在一臺電腦共存的實現方法

    vue-cli2與vue-cli3在一臺電腦共存的實現方法

    這篇文章主要介紹了vue-cli2與vue-cli3在一臺電腦共存的實現方法,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2019-09-09
  • 詳解Vue 數據更新了但頁面沒有更新的 7 種情況匯總及延伸總結

    詳解Vue 數據更新了但頁面沒有更新的 7 種情況匯總及延伸總結

    這篇文章主要介紹了詳解Vue 數據更新了但頁面沒有更新的 7 種情況匯總及延伸總結,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-05-05
  • vue中插槽整理及用法分析

    vue中插槽整理及用法分析

    在本篇文章里小編給大家整理的是一篇關于vue中插槽整理及用法分析內容,對此有興趣的朋友們可以跟著學習下。
    2021-12-12
  • mpvue將vue項目轉換為小程序

    mpvue將vue項目轉換為小程序

    這篇文章主要介紹了mpvue將vue項目轉換為小程序的相關資料及mpvue開發(fā)流程,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下
    2018-09-09
  • Vue微信公眾號網頁分享的示例代碼

    Vue微信公眾號網頁分享的示例代碼

    這篇文章主要介紹了Vue微信公眾號網頁分享的示例代碼,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-05-05

最新評論