jeecg-boot 1.0版本发布

This commit is contained in:
zhangdaihao
2019-02-25 15:58:05 +08:00
parent 2897a52d1d
commit 3013925104
385 changed files with 60058 additions and 1 deletions

View File

@ -0,0 +1,74 @@
<template>
<a-date-picker
:disabled="readOnly"
:placeholder="placeholder"
@change="handleDateChange"
:value="momVal"
:showTime="showTime"
:format="dateFormat"
/>
</template>
<script>
import moment from 'moment'
export default {
name: 'JDate',
props: {
placeholder:{
type: String,
default: '',
required: false
},
value:{
type: String,
default: '',
required: false
},
dateFormat:{
type: String,
default: 'YYYY-MM-DD',
required: false
},
triggerChange:{
type: Boolean,
required: false,
default: false
},
readOnly:{
type: Boolean,
required: false,
default: false
},
showTime:{
type: Boolean,
required: false,
default: false
}
},
data () {
let dateStr = this.value;
return {
decorator:"",
momVal:!dateStr?null:moment(dateStr,this.dateFormat)
}
},
watch: {
value (val) {
if(!val){
this.momVal = null
}else{
this.momVal = moment(val,this.dateFormat)
}
}
},
methods: {
moment,
handleDateChange(mom,dateStr){
if(this.triggerChange){
this.$emit('change', dateStr);
}else{
this.$emit('input', dateStr);
}
}
}
}
</script>

View File

@ -0,0 +1,43 @@
日期组件
说明antd-vue日期组件需要用moment中转一下用起来不是很方便特二次封装使用时只需要传字符串即可
====
参数说明
----
placeholderplaceholder
readOnlytrue/false
value绑定v-model或是v-decorator后不需要设置
showTime是否展示时间true/false
dateFormat日期格式 默认'YYYY-MM-DD' 若showTime设置为true则需要将其设置成对应的时间格式(如YYYY-MM-DD HH:mm:ss)
triggerChange触发组件值改变的事件是否是change,当使用v-decorator时且没有设置decorator的option.trigger为input需要设置该值为true
使用示例
----
1.组件带有v-model的使用方法
<j-date v-model="dateStr"></j-date>
2.组件带有v-decorator的使用方法
a).设置trigger-change属性为true
<j-date :trigger-change="true" v-decorator="['dateStr',{}]"></j-date>
b).设置decorator的option.trigger为input
<j-date v-decorator="['dateStr',{trigger:'input'}]"></j-date>
3.其他使用
添加style
<j-date v-model="dateStr" style="width:100%"></j-date>
添加placeholder
<j-date v-model="dateStr" placeholder="请输入dateStr"></j-date>
添加readOnly
<j-date v-model="dateStr" :read-only="true"></j-date>
备注:
script内需引入jdate
<script>
import JDate from '@/components/jeecg/JDate'
export default {
name: "demo",
components: {
JDate
},
....
</script>