-
Notifications
You must be signed in to change notification settings - Fork 511
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
Vue.js: browser.html: expose attribute name mapper #1187
Comments
For this issue, as well as for #1186, you can use button = BUTTON("hello-kitty", **{"v-on:click": "count++"}) Instead of the replacement of underscore by hyphen, which is questionable because it doesn't allow names with underscores as attribute names, it would probably be better to remove it, and mention the syntax above for attribute names that are not valid Python names. What do you think ? |
re: |
I don't think it's so ugly and I will document it, but what do you mean by "exposing attribute name generator" ? Can you give an example of the API you would like for that ? |
the api would be direct regex mapper:
for example, for
|
I don't agree with this suggestion :
Another solution would be to define a function import re
import browser.html
def vue_attr(attr):
return re.sub("^v_(.*)_(.*)$", "v-\1:\2", attr)
browser.html.attribute_mapper = vue_attr
html.BUTTON(v_on_click="count++") Would that be ok ? |
re: |
I think the commit above fixes the issue, it not feel free to reopen it. Thanks for the report ! |
yes, that should fix it. please release? :-) |
see BUG: works only once: If the attribute contains a hyphen (-) it must be replaced by an underscore (_) #1186
vue.js
likes crazy html attribute names:https://vuejs.org/v2/guide/events.html
please expose attribute name generator:
https://github.com/brython-dev/brython/blob/master/www/src/builtin_modules.js#L225
so that the following convention
v_on_click
->v-on:click
can be implemented:
The text was updated successfully, but these errors were encountered: