Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Commit

Permalink
Fixing bugs on form-field
Browse files Browse the repository at this point in the history
  • Loading branch information
Javiani committed Apr 20, 2021
1 parent d9b78fa commit 4900909
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion form2/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions form2/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,15 @@ export default function formField ({ main, elm, msg, injection, emit, update, tr

update( props => {
const field = elm.querySelector('input,select,textarea')
msg.set( s => {
msg.set( s => {
s.data = props.data
s.value = !s.touched? field.dataset.initialValue: s.value
if( s.value && !s.touched ) {
setTimeout(_ => {
trigger('input', `[name=${field.name}]`)
trigger('change', `[name=${field.name}]`)
}, 150)
s.value = field.value
})
s.touched = true
}
})
Expand All @@ -111,7 +112,7 @@ export const model = {
touched: false,
focus : false,
error : null,
isValid: false,
isValid: true,
value : undefined,
data : {}
}
Expand Down

0 comments on commit 4900909

Please sign in to comment.