export default {
name: "Test",
data() {
return {
};
},
//在data外面定义的属性和方法通过$options可以获取和调用
name: "zs",
age: 12,
haha() {
console.log("haha");
},
created() {
console.log(this.$options.name); // zs
console.log(this.$options.age); //12
this.$options.haha(); // haha
},
}
vue的实例属性$options
vue的实例属性$options是用来获取定义在data外的数据和方法的。
