最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vant時間控件使用方法詳解

 更新時間:2020年12月24日 11:20:24   作者:小曲曲  
這篇文章主要為大家詳細介紹了vant時間控件的使用方法,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了vant時間控件的使用方法,供大家參考,具體內(nèi)容如下

代碼:

<template>
 <div class="shoukuan">
  <!-- 頭部公共搜索框 -->
  <tabbar title="添加團隊活動"></tabbar>
  <div class="con">
   <van-cell-group>
    <van-field v-model="name" clearable label="活動名稱" placeholder="請選擇活動名稱" />
    <van-field v-model="starttime" clearable label="開始時間" placeholder="請輸入開始時間" @focus="start" />
    <van-field v-model="endtime" clearable label="結束時間" placeholder="請輸入結束時間" @focus="end" />
   </van-cell-group>
   <van-cell-group>
    <van-field
     v-model="message"
     rows="2"
     autosize
     label="活動詳情"
     type="textarea"
     maxlength="50"
     placeholder="請輸入"
     show-word-limit
    />
   </van-cell-group>
  </div>
  <van-button type="primary" size="large" @click="add">確認添加</van-button>
  <!-- 開始時間控件 -->
  <van-popup v-model="show" position="bottom">
   <van-datetime-picker
    v-model="currentDate"
    type="datetime"
    :min-date="minDate"
    :max-date="maxDate"
    @confirm="confirm"
    @cancel="cancel"
    :formatter="formatter"
   />
  </van-popup>
  <!-- 結束時間控件 -->
  <van-popup v-model="show1" position="bottom">
   <van-datetime-picker
    v-model="currentDate1"
    type="datetime"
    :min-date="minDate"
    :max-date="maxDate"
    @confirm="confirm1"
    @cancel="cancel1"
    :formatter="formatter"
   />
  </van-popup>
 </div>
</template>
<script>
import tabbar from "../../components/navbar";
export default {
 data() {
  return {
   name: "", //活動名稱
   message: "", //活動詳情
   show: false, //開始時間彈窗
   show1: false, //結束時間彈窗
   minHour: 10,
   maxHour: 20,
   minDate: new Date(),
   maxDate: new Date(2020, 11, 31),
   currentDate: new Date(), //開始標準時間
   currentDate1: new Date(), //結束標準時間
   starttime: "", //開始時間
   starttime1: "", //開始時間時間戳
   endtime: "", //結束時間
   endtime1: "" //結束時間時間戳
  };
 },
 components: {
  tabbar
 },
 mounted() {},
 methods: {
  // 選擇開始時間
  start() {
   this.show = true;
  },
  // 選擇結束時間
  end() {
   this.show1 = true;
  },
  // 點擊確定
  confirm() {
   this.show = false;
   this.starttime =
    this.currentDate.getFullYear() +
    "年" +
    (Number(this.currentDate.getMonth()) + 1) +
    "月" +
    this.currentDate.getDate() +
    "日 " +
    this.currentDate.getHours() +
    ":" +
    this.currentDate.getMinutes();
   this.starttime1 = new Date(this.currentDate).getTime() / 1000;
  },
  // 點擊取消
  cancel() {
   this.show = false;
  },
  confirm1() {
   this.show1 = false;
   this.endtime =
    this.currentDate1.getFullYear() +
    "年" +
    (Number(this.currentDate1.getMonth()) + 1) +
    "月" +
    this.currentDate1.getDate() +
    "日 " +
    this.currentDate1.getHours() +
    ":" +
    this.currentDate1.getMinutes();
   this.endtime1 = new Date(this.currentDate1).getTime() / 1000;
  },
  cancel1() {
   this.show1 = false;
  },
  // 處理控件顯示的時間格式
  formatter(type, value) {
   // 格式化選擇器日期
   if (type === "year") {
    return `${value}年`;
   } else if (type === "month") {
    return `${value}月`;
   } else if (type === "day") {
    return `${value}日`;
   } else if (type === "hour") {
    return `${value}時`;
   } else if (type === "minute") {
    return `${value}分`;
   }
   return value;
  },
  // 點擊添加按鈕
  add() {
   if (
    !this.name.trim() ||
    !this.starttime.trim() ||
    !this.starttime.trim() ||
    !this.message.trim()
   ) {
    this.$toast("請輸入完整的活動信息");
   } else {
    this.axios
     .post("/api/agent_team/addTeamActivity", {
      activity_name: this.name,
      activity_content: this.message,
      start_time: this.starttime1,
      end_time: this.endtime1
     })
     .then(data => {
      this.$toast("添加活動成功");
      setTimeout(() => {
       this.$router.go(-1);
      }, 1000);
     });
   }
  }
 }
};
</script>

<style lang="less" scoped>
.shoukuan {
 padding-top: 44px;
 .van-button--large {
  width: 92%;
  margin-left: 4%;
  margin-top: 25%;
 }
}
</style>

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

相關文章

  • vue中el表單的簡單查詢方法

    vue中el表單的簡單查詢方法

    本文主要介紹了vue中el表單的簡單查詢方法,主要包括表單頁面根據(jù)groupid 、type 、errortype進行數(shù)據(jù)過濾,感興趣的可以了解一下
    2023-10-10
  • vue3如何使用setup代替created

    vue3如何使用setup代替created

    Vue3中的setup是一個新的生命周期函數(shù),它可以用來代替組件中的 data和一些生命周期函數(shù)(如created和beforeMount),這篇文章主要介紹了vue3如何使用setup代替created的相關資料,需要的朋友可以參考下
    2023-09-09
  • vue實現(xiàn)div拖拽互換位置

    vue實現(xiàn)div拖拽互換位置

    這篇文章主要為大家詳細介紹了vue實現(xiàn)div拖拽互換位置的方法,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-12-12
  • 前端配合后端實現(xiàn)Vue路由權限的方法實例

    前端配合后端實現(xiàn)Vue路由權限的方法實例

    一開始我還以為vue的路由只能用在工程化的項目里面,其實不然,下面這篇文章主要給大家介紹了關于前端配合后端實現(xiàn)Vue路由權限的相關資料,文中通過實例代碼介紹的非常詳細,需要的朋友可以參考下
    2022-05-05
  • Vue實現(xiàn)簡易記事本

    Vue實現(xiàn)簡易記事本

    這篇文章主要為大家詳細介紹了Vue實現(xiàn)簡易記事本,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-04-04
  • 基于Vue實現(xiàn)timepicker

    基于Vue實現(xiàn)timepicker

    這篇文章主要為大家詳細介紹了基于Vue實現(xiàn)timepicker效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-04-04
  • vue element項目引入icon圖標的方法

    vue element項目引入icon圖標的方法

    這篇文章主要介紹了vue element項目引入icon圖標的方法,本文圖文并茂給大家介紹的非常詳細,需要的朋友可以參考下
    2018-06-06
  • vue使用tracking實現(xiàn)人臉識別/人臉偵測完整代碼

    vue使用tracking實現(xiàn)人臉識別/人臉偵測完整代碼

    作為一個AI模型,人臉識別涉及到多個技術領域,下面這篇文章主要給大家介紹了關于vue使用tracking實現(xiàn)人臉識別/人臉偵測的相關資料,文中通過代碼介紹的非常詳細,需要的朋友可以參考下
    2023-09-09
  • Vue3實現(xiàn)跨頁面?zhèn)髦档膸追N常見方法

    Vue3實現(xiàn)跨頁面?zhèn)髦档膸追N常見方法

    在Vue 3中,跨頁面?zhèn)髦悼梢酝ㄟ^多種方式實現(xiàn),具體選擇哪種方法取決于應用的具體需求和頁面間的關系,本文列舉了幾種常見的跨頁面?zhèn)髦捣椒?感興趣的同學跟著小編來看看吧
    2024-04-04
  • vue實現(xiàn)定時刷新數(shù)據(jù),每隔5分鐘執(zhí)行一次

    vue實現(xiàn)定時刷新數(shù)據(jù),每隔5分鐘執(zhí)行一次

    這篇文章主要介紹了vue實現(xiàn)定時刷新數(shù)據(jù),每隔5分鐘執(zhí)行一次問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-01-01

最新評論

连平县| 东丰县| 浪卡子县| 江达县| 长葛市| 融水| 寻甸| 双桥区| 西充县| 顺平县| 清镇市| 巍山| 张家界市| 遂溪县| 樟树市| 邵阳县| 宁波市| 乌海市| 玛多县| 都昌县| 岗巴县| 嘉祥县| 甘洛县| 水城县| 东海县| 丹棱县| 正安县| 新平| 石嘴山市| 乐至县| 元江| 莫力| 石景山区| 邻水| 新和县| 博客| 报价| 淳化县| 西青区| 万宁市| 阳信县|