翻閱古今
2022-05-26 10:36:23
我有一個電子項目,我正在其中實現(xiàn) vuejs。我能夠加載 vue 腳本,并且瀏覽器窗口將正確打開 index.html 文件,其中包含使用 bootstrap 4 制作的 GUI。我注意到 vue 實例不會處理{{ hello }}vue 使用的語法。我不知道問題出在哪里,但我認為這與電子工作方式有關(guān),會導(dǎo)致 vue 出現(xiàn)問題?我已經(jīng)使用它安裝了它,npm install vue --save-dev并且所有項目依賴項(如 bootstrap 和 jQuery)都是使用相同的方法安裝的。這是我的代碼包.json 文件{ "name": "clients-manager", "version": "1.0.0", "description": "A simple hosting credentials manager app", "main": "main.js", "scripts": { "start": "electron ." }, "license": "ISC", "dependencies": { "bootstrap": "^4.4.1", "dexie": "^2.0.4", "jquery": "^3.4.1", "popper.js": "^1.16.1", "vue": "^2.6.11" }}main.js Javascriptconst electron = require('electron');const { app, BrowserWindow } = electron;function createWindow(){ let win = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true } }); win.loadFile('index.html'); var myapp = new Vue({ el: '#app', data: { hello: 'Hello Vue!' } }); console.log(myapp);}app.whenReady().then(createWindow);索引.html<div class="col-4" id="app"> <ul class="nav ml-auto"> <li class="nav-item"> <a class="nav-link" href="#">{{ hello }}</a> </li> </ul></div>
2 回答
qq_遁去的一_1
TA貢獻1725條經(jīng)驗 獲得超8個贊
你沒有定義hello,你message 在 VUE 數(shù)據(jù)中定義
用這個
var myapp = new Vue({
el: '#app',
data: {
hello: 'Hello Vue!'
}
});
MMMHUHU
TA貢獻1834條經(jīng)驗 獲得超8個贊
我使用 electron-vue 樣板創(chuàng)建了一個項目。
你可以簡單地用 npm 試試。
# Install vue-cli and scaffold boilerplate
npm install -g vue-cli
vue init simulatedgreg/electron-vue my-project
# Install dependencies and run your app
cd my-project
yarn # or npm install
yarn run dev # or npm run dev
更多信息請參考鏈接https://simulatedgreg.gitbooks.io/electron-vue/content/en/。
添加回答
舉報
0/150
提交
取消
