vue的實例屬性$options是用來獲取定義在data外的數據和方法的。
<script> 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 }, </script>