vue watch用法问题 - 已解决

Method "watch" has type "object" in the component definition. Did you reference the function correctly?

watch定义问题。

正确示例:

export default {
 name: "Demo",
 components: {},
 data() {
  return {  };
 },
 props: { type: String},
 watch: {
  type(val) {}
  },
 methods: {}
}

注:watch是vue内置特性与其他属性平级。