We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I've created a basic custom element based on template-custom-element but the component's methods don't seem to being added to the compiled JS.
My component
<h1>Hello {{name}}!</h1> <button on:click="saySomething()">Click me</button> <script> export default { tag: 'my-app', data() { return { 'name': 'World' } }, methods: { saySomething() { alert('Again, please don\'t do this'); } } }; </script>
Clicking on the button throws an error:
Uncaught TypeError: component.saySomething is not a function at HTMLButtonElement.click_handler (App.html:3)
Full example is here: https://github.com/willtj/template-custom-element
The text was updated successfully, but these errors were encountered:
assign custom methods to custom element prototype - fixes #1369
ef39f00
Merge pull request #1375 from sveltejs/gh-1369
ff45a53
assign custom methods to custom element prototype
Thanks — fixed in 2.3.0
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
I've created a basic custom element based on template-custom-element but the component's methods don't seem to being added to the compiled JS.
My component
Clicking on the button throws an error:
Full example is here: https://github.com/willtj/template-custom-element
The text was updated successfully, but these errors were encountered: