1.1 mint-ui安装与介绍

   官网:http://mint-ui.github.io/docs/#/zh-cn2/loadmore

  1、安装与引用

// 安装Vue 2.0
npm install mint-ui -S
// 引入全部组件
import Vue from 'vue';
import Mint from 'mint-ui';
Vue.use(Mint);

1.2 Datetime Picker的用法

  参考博客:https://blog.csdn.net/qq_35430000/article/details/82183079

<template>
<div class="pickerDemo">
<div class="showTime">
<p class="timeDes">当前时间是:{{this.selectedValue}}</p>
<div class="selectTime" @click="selectData">选择时间</div>
</div>
<!-- @touchmove.prevent 阻止默认事件,此方法可以在选择时间时阻止页面也跟着滚动。 -->
<div class="pickerPop" @touchmove.prevent>
<!-- 年月日时分选择 -->
<mt-datetime-picker
lockScroll="true"
ref="datePicker"
v-model="dateVal"
class="myPicker"
type="datetime"
year-format="{value}"
month-format="{value}"
date-format="{value}"
hour-format="{value}"
minute-format="{value}"
second-format="{value}"
@confirm="dateConfirm()">
</mt-datetime-picker>
</div>
</div>
</template> <script>
import Vue from 'vue'
import {formatDate} from '@/assets/js/util/formatdate.js'
import {DatetimePicker } from 'mint-ui'
Vue.component(DatetimePicker.name, DatetimePicker)
export default {
name: 'pickerDemo',
data () {
return {
dateVal: '2019-04-17', // 默认是当前日期
selectedValue: '2019-04-17'
}
},
components: {
},
methods: { //获取当前时间,格式YYYY-MM-DD
getNowFormatDate(){
var date = new Date();
var seperator1 = "-";
var year = date.getFullYear();
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = year + seperator1 + month + seperator1 + strDate;
return currentdate;
}, // 打开时间选择器
selectData () {
// 如果已经选过日期,则再次打开时间选择器时,日期回显(不需要回显的话可以去掉 这个判断)
if (this.selectedValue) {
this.dateVal = this.selectedValue
} else {
this.dateVal = new Date()
}
this.$refs['datePicker'].open()
}, // 时间选择器确定按钮,并把时间转换成我们需要的时间格式
dateConfirm () {
this.selectedValue = formatDate(this.dateVal)
}
},
created () {
var nowData = this.getNowFormatDate();
this.selectedValue = nowData;
},
}
</script> <style scoped> </style>

index.vue

// 只有年月日
export function formatDate (secs) {
var t = new Date(secs)
var year = t.getFullYear()
var month = t.getMonth() + 1
if (month < 10) { month = '0' + month }
var date = t.getDate()
if (date < 10) { date = '0' + date }
var hour = t.getHours()
if (hour < 10) { hour = '0' + hour }
var minute = t.getMinutes()
if (minute < 10) { minute = '0' + minute }
var second = t.getSeconds()
if (second < 10) { second = '0' + second }
return year + '-' + month + '-' + date
}
// 年月日时分
export function formatDateMin (secs) {
var t = new Date(secs)
var year = t.getFullYear()
var month = t.getMonth() + 1
if (month < 10) { month = '0' + month }
var date = t.getDate()
if (date < 10) { date = '0' + date }
var hour = t.getHours()
if (hour < 10) { hour = '0' + hour }
var minute = t.getMinutes()
if (minute < 10) { minute = '0' + minute }
var second = t.getSeconds()
if (second < 10) { second = '0' + second }
return year + '-' + month + '-' + date + ' ' + hour + ':' + minute + ':' + second
}

src\assets\js\util\formatdate.js

1111111

16: mint-ui移动端的更多相关文章

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

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

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

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

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

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

  4. Mint UI Example的运行

    Mint -UI是新推出的移动端UI框架 官网 不过官网上的文档例子不是很全面. 建议下载他们提供的example来学习. 1.examplle源码下载地址 2.打开项目,我这里使用webstorm, ...

  5. vuetify,vux,Mint UI 等框架的选择

    vuetify: https://vuetifyjs.com/zh-Hans/getting-started/quick-start NutUI:https://github.com/jdf2e/nu ...

  6. Vue移动组件库Mint UI的安装与使用

    一.什么是 Mint UI 1.Mint UI 包含丰富的 CSS 和 JS 组件,可以提升移动端开发效率 2.Mint UI 按需加载组件 3.Mint UI 轻量化 二.Mint UI 的安装 1 ...

  7. 基于Mint UI和MUI开发VUE项目一之环境搭建和首页的实现

    一:简介 Mint UI 包含丰富的 CSS 和 JS 组件,能够满足日常的移动端开发需要.通过它,可以快速构建出风格统一的页面,提升开发效率.真正意义上的按需加载组件.可以只加载声明过的组件及其样式 ...

  8. 第16讲- UI组件之TextView

    第16讲 UI组件之TextView Android系统所有UI类都是建立在View和ViewGroup这两类的基础上的. 所有View的子类称为widget:所有ViewGroup的子类称为Layo ...

  9. vue mint UI

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

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

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

随机推荐

  1. hive时间日期函数及典型场景应用

    1.hive取得当前日期时间: 1.1) 取得当前日期: select current_date(); 1.2) 取得当前日期时间: select current_timestamp(); 1.3) ...

  2. Python的基本语法1

    一.python的基本数据类型 (1)6种基本数据类型 1.数字类型 int 整数,2,0,-4等 float 浮点数,如1.2,-0.3等 bool 布尔类型,True,False complex ...

  3. 快递单号自动识别接口API-trackingmore

    一.快递单号自动识别接口功能说明 (1)PC电脑端.移动APP或者自建网站集成物流查询功能时,只需要用户输入单号即可,不需要输入快递公司. (2)此接口可以配合Trackingmore的快递查询API ...

  4. 修改文件MD5值

    1.查看文件的MD5值 (1)下载MD5Checker http://getmd5checker.com/download.html 或者 链接: https://pan.baidu.com/s/1e ...

  5. vue/cli3 配置相对路径

    根目录下新建 vue.config.js 文件 const path = require('path') function resolve(dir){ return path.join(__dirna ...

  6. PCL近邻搜索相关的类

    首先PCL定义了搜索的基类pcl::search::Search<PointInT> template<typename PointT> class Search 其子类包括: ...

  7. Azure基础(三)- Azure的物理架构和服务保证

    Azure fundamentals - Core Cloud Services - Azure architecture and service guarantees Azure provides ...

  8. Oracle 11g R2性能优化 SQL TRACE

    作为Oracle官方自带的一种基本性能诊断工具,SQL Trace可以用来评估当前正在运行的SQL语句的效率,同时为该语句生成统计信息等,并保存这些信息到指定路径下的跟踪文件(trace)当中.SQL ...

  9. android模拟器访问PC本地接口

    一般来讲PC本地接口是localhost:8080 而在安卓模拟器上用的话,他会映射模拟器本身的,也就是说,可以把模拟器也当成一个PC端来看待,这样会好理解点吧 而在模拟器上想要访问PC本地的loca ...

  10. 使用datagrid时json的格式

    EasyUI的DataGrid要求返回的JSON数据集是这样的形式: {"total":总记录数量,"rows":[数据记录数组]}. 例如: {"t ...