You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be an extensions of the props API that would allow us to sanitize a given value for a property before passing it onto the component instance. Right now there is no real way of doing this before the value is being set on the component.
What does the proposed API look like?
This whould work very similarly to how validators for props work, by passing a sanitizer function in the prop definition.
Vue.component('my-component', {
props: {
title: {
type: String,
// Custom sanitization function
sanitizer: function (value) {
// The title must not have any leading or trailing whitespace
return value.trim()
}
}
}
})
The text was updated successfully, but these errors were encountered:
This was purposely removed (coerce) because it can be achieved with a computed property.
the sanitizer thing can actually be created as a plugin
You may find this FR to help: #7943
What problem does this feature solve?
It would be an extensions of the props API that would allow us to sanitize a given value for a property before passing it onto the component instance. Right now there is no real way of doing this before the value is being set on the component.
What does the proposed API look like?
This whould work very similarly to how validators for props work, by passing a sanitizer function in the prop definition.
The text was updated successfully, but these errors were encountered: