Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Feature Request ] Can form related elements add some event triggers? #271

Closed
kevytlab opened this issue Jan 18, 2022 · 1 comment
Closed

Comments

@kevytlab
Copy link

Is your feature request related to a problem? Please describe.

For example: emt('filedBlur', true) when ItInput loses focus.

Describe the solution you'd like

Can't tell Itinput lost focus when I want to do an assembly of Itinput and async-validator

Describe alternatives you've considered

<input @focus="handleFocus"
        @blur="handleBlur" **** />


 const handleFocus = (event: FocusEvent) => {
      focused.value = true
      emit('focus', event)
    }
    const handleBlur = (event: FocusEvent) => {
      focused.value = false
      emit('blur', event)
    }

Additional context

No response

@kevytlab
Copy link
Author

kevytlab commented Jan 19, 2022

FormItem.vue
`<script setup lang="ts">
const props = defineProps({
prop: {
type: String,
default: null,
}
})
const message = ref()
const status = ref()
const errorFields: any = inject('errorFields')
watch(errorFields, (val: any) => {
if (val[props.prop]) {
message.value = val[props.prop][0].message
status.value = 'danger'
} else {
message.value = null
status.value = null
}
})
</script>

<style scoped lang="scss"> </style>`

How to get the ItInput loses focus event or the value changes in FormItem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants