vue-function-api icon indicating copy to clipboard operation
vue-function-api copied to clipboard

TypeError: Cannot read property 'refs' of undefined

Open parker-codes opened this issue 6 years ago • 1 comments

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 };
}

parker-codes avatar Jun 24 '19 18:06 parker-codes

Upgrade to vue-function-api 2.x.

liximomo avatar Jun 25 '19 03:06 liximomo