vue-function-api
vue-function-api copied to clipboard
TypeError: Cannot read property 'refs' of undefined
It doesn't look like the second parameter 'context' is defined. The custom hooks are irrelevant to the issue, but this is how I am using them.
This is my code:
setup(props, context) {
const message = value("Hello Vue in CodeSandbox!");
const messageUppercase = computed(() => message.value.toUpperCase());
useKeypress("j", () => {
console.log("clicked!");
});
useElementKeypress("u", context.refs.elementKeypress, () => {
console.log("clicked!");
});
return { message, messageUppercase };
}
Upgrade to vue-function-api 2.x.