Skip to content

Commit

Permalink
fix: 新增 uni-datetime-picker
Browse files Browse the repository at this point in the history
  • Loading branch information
mehaotian committed Jan 11, 2021
1 parent 2b2e2ad commit cb35184
Show file tree
Hide file tree
Showing 5 changed files with 696 additions and 413 deletions.
6 changes: 4 additions & 2 deletions components/uni-datetime-picker/uni-datetime-picker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
if (this.formItem) {
if (this.formItem.name) {
this.rename = this.formItem.name
this.rename = this.formItem.name
this.form.inputChildrens.push(this)
}
}
Expand Down Expand Up @@ -207,7 +207,9 @@
this.visible = !this.visible
},
clearTime() {
this.time = ''
this.time = ''
this.formItem && this.formItem.setValue(this.time)
this.$emit('change', this.time)
this.tiggerTimePicker()
},
initTime() {
Expand Down
19 changes: 10 additions & 9 deletions components/uni-forms/uni-forms.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@
this.inputChildrens = []
this.checkboxChildrens = []
this.formRules = []
this.init(this.rules)
// this.init(this.rules)
},
mounted() {
this.init(this.rules)
},
methods: {
init(formRules) {
// 判断是否有规则
Expand All @@ -129,12 +131,11 @@
} else {
return
}
// 判断表单存在那些实例
for (let i in this.value) {
const itemData = this.childrens.find(v => v.name === i)
for (let i in this.value) {
const itemData = this.childrens.find(v => v.name === i)
if (itemData) {
this.formData[i] = this.value[i]
this.formData[i] = this.value[i]
itemData.init()
}
}
Expand Down Expand Up @@ -260,7 +261,7 @@
fieldsValue[i] = tempInvalidFields[i]
}
}
}
}
let result = []
let example = null
Expand All @@ -269,7 +270,7 @@
newFormData[v.name] = invalidFields[v.name] || this._getValue(v.name, '')
})
if (this.validator) {
for (let i in fieldsValue) {
for (let i in fieldsValue) {
// 循环校验,目的是异步校验
const resultData = await this.validator.validateUpdate({
[i]: fieldsValue[i]
Expand Down Expand Up @@ -423,7 +424,7 @@
* @param {Object} format
*/
type_filter(format) {
return format === 'int' || format === 'double' || format === 'number'
return format === 'int' || format === 'double' || format === 'number' || format === 'timestamp'
}
}
}
Expand Down
Loading

0 comments on commit cb35184

Please sign in to comment.