提交 3a345895 编写于 作者: zhujiamin's avatar zhujiamin

Revert "debug 时间格式化"

This reverts commit 72aa7246.
上级 72aa7246
<template>
<div class="app-mobile-datetime-picker">
<ion-icon
v-if="curValue"
name="close-circle-outline"
@click="clear"
></ion-icon>
<ion-datetime
:max="max"
:min="min"
display-format="YYYY-MM-DD hh:mm"
:value="value"
:placeholder="placeholder"
:disabled="disabled"
@ionChange="valueChange($event)"
:cancel-text="$t('cancel_text')"
:done-text="$t('done_text')"
></ion-datetime>
</div>
<div class="app-mobile-datetime-picker">
<ion-icon v-if="curValue" name="close-circle-outline" @click="clear"></ion-icon>
<ion-datetime
:max="max"
:min="min"
display-format="YYYY-MM-DD hh:mm"
:value="value"
:placeholder="placeholder"
:disabled="disabled"
@ionChange="valueChange($event)"
:cancel-text="$t('cancel_text')"
:done-text="$t('done_text')"
></ion-datetime>
</div>
</template>
<script lang="ts">
import {
Vue,
Component,
Prop,
Provide,
Emit,
Watch,
} from 'vue-property-decorator';
const moment = require('moment');
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
const moment = require('moment');
@Component({
@Component({
i18n: {
messages: {
'ZH-CN': {
cancel_text: '取消',
done_text: '完成',
},
'EN-US': {
cancel_text: 'cancel',
done_text: 'submit',
},
},
messages: {
'ZH-CN': {
cancel_text: '取消',
done_text: '完成'
},
'EN-US': {
cancel_text: 'cancel',
done_text: 'submit'
}
}
},
components: {},
})
export default class AppDateTimePicker extends Vue {
components: {
}
})
export default class AppDateTimePicker extends Vue {
/**
* 传入值
*
* @type {string}
* @memberof AppDateTimePicker
*/
@Prop() public value?: string;
@Prop() public value?:string;
/**
* 当前选中值
* @memberof AppDateTimePicker
*/
public curValue: any = this.value;
public curValue:any = this.value;
/**
* 当前日期
* @type {*}
* @memberof MOBILEENTITY3Canlen
*/
protected currentDate: any = new Date().getFullYear();
protected currentDate:any = new Date().getFullYear();
/**
* 当前选中值
* @memberof AppDateTimePicker
*/
public min: any = this.currentDate - 100;
public max: any = this.currentDate + 100;
public min:any = this.currentDate - 100;
public max:any = this.currentDate + 100;
/**
* 是否禁用
......@@ -79,7 +72,7 @@
* @type {boolean}
* @memberof AppDateTimePicker
*/
@Prop() public disabled?: boolean;
@Prop() public disabled?:boolean;
/**
* placeholder
......@@ -87,33 +80,33 @@
* @type {boolean}
* @memberof AppDateTimePicker
*/
@Prop() public placeholder?: string;
@Prop() public placeholder?:string;
/**
*时间选择改变
*
* @param event{*}
* @memberof AppDateTimePicker
*/
public valueChange(event: any) {
this.curValue = moment(event.detail.value).format('YYYY-MM-DD hh:mm:ss');
this.$emit('change', this.curValue);
*
* @param event{*}
* @memberof AppDateTimePicker
*/
public valueChange(event:any){
this.curValue = event.detail.value;
this.$emit('change',event.detail.value);
}
/**
* 清空值
* @memberof AppDateTimePicker
*/
public clear() {
this.curValue = null;
this.$emit('change', '');
}
public clear(){
this.curValue = null;
this.$emit('change','')
}
created() {
console.log(this.currentDate);
created(){
console.log(this.currentDate);
}
}
}
</script>
<style lang="less">
@import './app-mob-datetime-picker.less';
</style>
@import './app-mob-datetime-picker.less';
</style>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册