一基本使用
<template>
<mt-datetime-picker
ref="picker"
type="time"
v-model="pickerValue">
</mt-datetime-picker>
</template> 备注:
1.ref,type,v-model 属性必须设置
2.v-model="pickerVisible" 需要在js里面声明pickerVisible
3. type里的值
  • datetime: 日期时间选择器,可选择年、月、日、时、分,value 值为一个 Date 对象
  • date: 日期选择器,可选择年、月、日,value 值为一个 Date 对象
  • time: 时间选择器,可选择时、分,value 值为一个格式为 HH:mm 的字符串

4.格式化回来的时间

建议使用momentjs 网址:http://momentjs.com/docs/#/displaying/

npm install moment
在vue里面import moment from 'moment';
handleConfirm(data) {
     this.searchTime = moment(data).format('YYYY-MM');
} 二,做开始时间结束时间使用时:
<el-row :gutter="0">
   <el-col :span="12">
      <el-button class="searchBtn searchTime" @click='openStartTime()'>
        <i class="fl el-icon-time"></i>
        <span>{{searchStartTime}}</span>
        <i class="fr el-icon-arrow-down"></i>
      </el-button>
  </el-col>
 <el-col :span="12">
    <el-button class="searchBtn searchTime" @click='openEndTime()'>
      <i class="fl el-icon-time"></i>
     <span>{{searchEndTime}}</span>
     <i class="fr el-icon-arrow-down"></i>
    </el-button>
 </el-col>
</el-row>
<!--时间插件 -->
<template>
 <mt-datetime-picker ref="startTime" v-model="startTimeVisible" type="date" year-format="{value} 年" month-format="{value} 月" date-format="{value} 日" @confirm="handleStartTimeConfirm">
 </mt-datetime-picker>
 <mt-datetime-picker ref="endTime" v-model="endTimeVisible" type="date" year-format="{value} 年" month-format="{value} 月" date-format="{value} 日" @confirm="handleEndTimeConfirm">
 </mt-datetime-picker>
</template>
<script>
import { DatetimePicker } from 'mint-ui';
import moment from 'moment';
export default {
  data() {
    return {
      startTimeVisible: '',
       searchStartTime: '请选择时间',
       endTimeVisible: '',
       searchEndTime: '请选择时间',
    }
  },
methods: {
    //打开开始时间
    openStartTime() {
      this.$refs.startTime.open();
    },
//打开结束时间
   openEndTime() {
      this.$refs.endTime.open();
   },
}
}
</script> 备注ref所指就是method方法所指openStartTime

mint-ui之datetime-picker使用的更多相关文章

  1. vue mint ui 手册文档对于墙的恐惧

    http://www.cnblogs.com/smallteeth/p/6901610.html npm 安装 推荐使用 npm 的方式安装,它能更好地和 webpack 打包工具配合使用. npm ...

  2. vue mint ui 手册文档

    npm 安装 推荐使用 npm 的方式安装,它能更好地和 webpack 打包工具配合使用. npm i mint-ui -S CDN 目前可以通过 unpkg.com/mint-ui 获取到最新版本 ...

  3. iOS开发UI篇—Date Picker和UITool Bar控件简单介绍

    iOS开发UI篇—Date Picker和UITool Bar控件简单介绍 一.Date Picker控件 1.简单介绍: Date Picker显示时间的控件 有默认宽高,不用设置数据源和代理 如何 ...

  4. iOS开发UI篇—使用picker View控件完成一个简单的选餐应用

    iOS开发UI篇—使用picker View控件完成一个简单的选餐应用 一.实现效果 说明:点击随机按钮,能够自动选取,下方数据自动刷新. 二.实现思路 1.picker view的有默认高度为162 ...

  5. vue mint UI

    vue 与mint  UI 结合开发手机app  html5页面 api  文档   http://mint-ui.github.io/#!/zh-cn

  6. 基于VUE.JS的移动端框架Mint UI

    Mint UI GitHub:github.com/ElemeFE/mint 项目主页:mint-ui.github.io/# Demo:elemefe.github.io/mint- 文档:mint ...

  7. Mint UI文档

    Mint UI文档:http://elemefe.github.io/mint-ui/#/ 一.Mint UI的安装和基本用法. 1.NPM :npm i mint-ui -S 建议使用npm进行安装 ...

  8. 新建一个基于vue.js+Mint UI的项目

    上篇文章里面讲到如何新建一个基于vue,js的项目(详细文章请戳用Vue创建一个新的项目). 该项目如果需要组件等都需要自己去写,今天就学习一下如何新建一个基于vue.js+Mint UI的项目,直接 ...

  9. iView webapp / Mint UI / MUI [前端UI]

    前端UI iView webapp一套高质量的 微信小程序 UI 组件库 https://weapp.iviewui.com/?from=iview Mint UI 基于 Vue.js 的移动端组件库 ...

  10. Mint UI 使用指南

    上来直接在webpack里将Mint UI引入项目,发现各种问题.饿了么组件库文档太坑了,好多地方写错,有些该说明的地方没说,比如例子里单文件.vue组件里用的类post-css处理器,我一直使用SA ...

随机推荐

  1. 安装python sklearn经验总结

    1. 需要安装 numpy, scipy, 和sklearn和ipython,Cython sklearn,ipython, Cython都可以通过pip来安装.但scipy,可能还有numpy必须通 ...

  2. Docker ssh server

    这个话题真让我气愤啊,在家里的mac上我已经全部摆平了,结果在公司的Linux上就给堵住了 原因不祥,但最后在错误提示里,有个移除(remove)信息,我照做了,就没问题了,全通了 大概是linux里 ...

  3. 38.html----相对于父元素的fixed定位的实现

    之前在项目中,遇到了一个场景,需要实现相对于父元素的fixed定位:在父元素内拖动滚动条时,"fixed"定位的元素不能滑动,在外层拖动滚动条时,父元素及父元素内的所有元素跟着一起 ...

  4. c# 在mongo中查询经纬度范围

    #region 索引 //IndexKeysDocument doc = new IndexKeysDocument();//新建索引 //2d 平面坐标索引,适用于基于平面的坐标计算.也支持球面距离 ...

  5. gispro设置标注属性字体样式设置

    为了应对电子地图和卫星影像的底图,标注样式选择比较关键.挑选了黑字白色晕圈效果.记住不是设置字体轮廓. 因为字体宽度(字粗)有限,设置轮廓直接把字体本身的颜色覆盖了

  6. DX9 顶点缓存案例

    // @time 2012.3.5 // @author jadeshu //包含头文件 #include <Windows.h> #include <d3d9.h> #pra ...

  7. django后台将最新文章显示在前面

    在你定义的views.py中修改 Models.objects.order_by("-pub_date")    更据时间排列 Models.objects.order_by(&q ...

  8. UML之状态机图

    状态机图 基本概念: 状态机图,UML 1.x规范中称状态图,是一个展示状态机的图. 状态机图基本上就是一个状态机中元素的投影,这也就意味着状态机图包括状态机的所有特征.状态机图显示了一个对象如何根据 ...

  9. STL(标准模板库)基本概念

    一.什么是STL STL(Standard Template Library,标准模板库)的从广义上讲分为三类:algorithm(算法).container(容器)和iterator(迭代器),容器 ...

  10. jQuery筛选--hasClass(class)和eq(index|-index)

    hasClass(class) 概述 检查当前的元素是否含有某个特定的类,如果有,则返回true 参数 class  用于匹配的类名 <!DOCTYPE html> <html> ...