You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when in the before_value_changed in HelloWorld.ts , use super.before_value_changed call the before_value_changed method of BaseComponent, it will product error.
HelloWorld.ts?b79b:13 Uncaught TypeError: Cannot read property 'call' of undefined
`class BaseComponent {
public before_value_changed() {
}
public on_value_changed() {
this.before_value_changed();
return "Hello, ";
}
}
class HelloWorld extends BaseComponent {
public before_value_changed() {
console.log('beforeGreet');
super.before_value_changed();
}
}
let hello = new HelloWorld();
Hello, your issue has been closed because it does not conform to our issue requirements. In order to ensure every issue provides the necessary information for us to investigate, we require the use of the Issue Helper when creating new issues. Thank you!
It only happened in Vue. (In typescript it works).
I use vue-cli to create a project and accord the
vuejs/vue-cli#1104
TypeStrong/fork-ts-checker-webpack-plugin#111
to split the .ts, .vue file in tow file.
and i write the follows code.
BaseComponent.ts
`import { Component, Prop, Vue } from 'vue-property-decorator';
@component({})
export default class BaseComponent extends Vue {
/**
* value changed
*/
public on_value_changed() {
this.before_value_changed();
}
}
`
HelloWorld.ts
`import { Component, Prop, Vue } from 'vue-property-decorator';
import BaseComponent from '@/components/BaseComponent';
@component({})
export default class HelloWorld extends BaseComponent {
// @prop() private msg!: string;
private count: number = 12;
}
`
HelloWorld.vue
<template> <div class="hello"> <button @click='on_value_changed'>Test</button> {{count}} </div> </template>
when in the before_value_changed in HelloWorld.ts , use super.before_value_changed call the before_value_changed method of BaseComponent, it will product error.
HelloWorld.ts?b79b:13 Uncaught TypeError: Cannot read property 'call' of undefined
in typescript, it work fine.
http://www.typescriptlang.org/play/index.html:
`class BaseComponent {
public before_value_changed() {
}
public on_value_changed() {
this.before_value_changed();
return "Hello, ";
}
}
class HelloWorld extends BaseComponent {
public before_value_changed() {
console.log('beforeGreet');
super.before_value_changed();
}
}
let hello = new HelloWorld();
let button = document.createElement('button');
button.textContent = "Say Hello";
button.onclick = function() {
alert(hello.on_value_changed());
}
document.body.appendChild(button);`
The text was updated successfully, but these errors were encountered: