How to receive directives instruction parameters in vue encapsulated components?

write an input box to build base-input , which focuses on managing styles and some ui logic. As the business expands, I need to customize the types that can be entered in the input box. Now I have written an instruction "only-num", how to pass this instruction from the outside when the caller calls base-input ?

Mar.05,2021

Custom hook-- ide/custom-directive.html" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/guide.
arg: the parameter passed to the instruction, optional. For example, in v-my-directive:foo, the parameter is "foo".
Vue.directive ('demo', {
bind: function (el, binding, vnode) {

)
var s = JSON.stringify
el.innerHTML =
  'name: '       + s(binding.name) + '<br>' +
  'value: '      + s(binding.value) + '<br>' +
  'expression: ' + s(binding.expression) + '<br>' +
  'argument: '   + s(binding.arg) + '<br>' +
  'modifiers: '  + s(binding.modifiers) + '<br>' +
  'vnode keys: ' + Object.keys(vnode).join(', ')

}
})


I think it is possible to send props directly without instructions, and then write the corresponding logic in the component


does not need instructions, but props

Menu