Currently we need to keep track manually of the directives / directive-modifier combination that we can support.
I propose a non-ambiguous naming convention that allows us to dynamically convert python keyword arguments into complex vue directives.
- Use triple
___ to indicate argument separator :
- Use double
__ to indicate modifier separator .
For example:
v_model__number -> v-model.number
v_on___click -> v-on:click
An extreme example:
v_complex_directive_name___complex_arg_value__complex_mod_name1__complex_mod_name2 -> v-complex-directive-name:complex-arg-value.complex-mod-name1.complex-mod-name2
Example implementation:
def py_to_js(s):
return s.replace("___", ":").replace("__", ".").replace("_", "-")
def js_to_py(s):
return s.replace(":", "___").replace(".", "__").replace("-", "_")