我用vscode工具搭建了vue項目,helloword也實現了,但是我在App.vue文件里面使用代碼:const vm = new Vue({ el: ".vueBox", data: { isChoose:false }, methods:{ imgScc:function () { this.isChoose = !this.isChoose } }會報Uncaught ReferenceError: Vue is not defined錯誤,這個vue對象為什么實例化不成功???main.js里面已經有import Vue from 'vue' 啊,請高手解答一下是什么原因?
2 回答

絕地無雙
TA貢獻1946條經驗 獲得超4個贊
/*!* Vue.js v1.0.12* (c) 2015 Evan You* Released under the MIT License.*/(function (global, factory) {typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :typeof define === 'function' && define.amd ? define(factory) :global.Vue = factory();}
通過你的第二張截圖看到你也用的是一個在線 js 資源。
看一下這個 js 資源有沒有正常的加載下來。
我從中把前幾行引用出來。你可以看到,實例化的全局變量的名稱。你可以通過斷點調試確認執行情況。
我看到你的這段代碼的上面還有一些代碼。你需要排除一下是不是上面的代碼對 Vue 實例有一些影響。
- 2 回答
- 0 關注
- 658 瀏覽
添加回答
舉報
0/150
提交
取消