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 define a mixin. I want it to be shared between my components
riot.mixin("hello",{sayHello: function() {return "Hello World!";}}) riot.mount("hello-world");
and my component is like that:
<hello-world> <h1>{message}</h1> <script> this.on("mount", function() { this.message = this.mixin("hello").sayHello(); this.update(); }.bind(this)) </script> </hello-world>
then I get this error: Uncaught TypeError: Cannot read property 'sayHello' of undefined
if I change this.mixin("hello").sayHello(); by riot.mixin("hello").sayHello(); like that, then all is all right
this.mixin("hello").sayHello();
riot.mixin("hello").sayHello();
<hello-world> <h1>{message}</h1> <script> this.on("mount", function() { this.message = riot.mixin("hello").sayHello(); this.update(); }.bind(this)) </script> </hello-world>
see the PR proposal #877 : #877
The text was updated successfully, but these errors were encountered:
riot.mixin("hello").sayHello() doesn't make sense. Try this.
riot.mixin("hello").sayHello()
<hello-world> <h1>{message}</h1> <script> this.mixin("hello") this.on("mount", function() { this.message = this.sayHello(); this.update(); }.bind(this)) </script> </hello-world>
But this seems still something weird. See the example below. It works as the same.
riot.mixin('hello', { message: "Hello World!" })
<hello-world> <h1>{ message }</h1> <script> this.mixin('hello') </script> </hello-world>
Sorry, something went wrong.
@cognitom oups! OK, I understood :) Thank you very much for you patience
No branches or pull requests
I define a mixin. I want it to be shared between my components
and my component is like that:
then I get this error: Uncaught TypeError: Cannot read property 'sayHello' of undefined
if I change
this.mixin("hello").sayHello();
byriot.mixin("hello").sayHello();
like that, then all is all rightsee the PR proposal #877 : #877
The text was updated successfully, but these errors were encountered: