1: 抽离子组件的方法:
一般在实际开发项目, 应用场景中, 总有一些可以多复用的东西。 就可以单独抽离出来组件。
2: 首先创建子组件:
EditComp.vue
3: 在父组件中引用子组件:
import EditComp from "./EditComp";
4: 注册组件:
注册组件:
component: {
EditComp
}
5: 就可以在父组件中使用子组件
报错信息: Property or method "disable" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. ===> { 属性或方法“disable”没有在实例上定义,而是在呈现时引用。通过初始化属性,确保该属性是响应性的(无论是在data选项中,还是对于基于类的组件)。属性或方法“disable”没有在实例上定义,而是在呈现时引用。通过初始化属性,确保该属性是响应性的(无论是在data选项中,还是对于基于类的组件)。 }