我加載的是我的代碼,像這樣引用了客戶端的js文件的模板中:vue.js - 實例上沒有定義,而引用的渲染
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.1/vue.js"></script>
<link rel="stylesheet" type="text/css" href="../css/app.css">
</head>
<body>
<div id="container">
<div id="map">
<script src="../js/app.js" type="text/javascript"></script>
<div id="offer-details">
<form id="offer-form" v-on:submit="makeOffer(tags, description, code)">
<input id="description"/>
<input id="tags"/>
<input id="code"/>
<input type="submit"/>
</form>
</div>
</div>
</div>
</body>
</html>
我的瀏覽器顯示以下內容(詳細信息。 js)加載成功。
var vm = new Vue({
el: "#details",
data: {
offer: {
publickey: '',
privatekey: '',
name: '',
service: '',
value: '',
currency: '',
tags: '',
description: '',
code: ''
},
methods: {
makeOffer: function makeOffer(){console.log(vm.publickey)}
}
}
})
然而,當我提出我收到以下錯誤消息的形式:
[Vue warn]: Property or method "makeOffer" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. (found in root instance)vue.js:2574:7
[Vue warn]: Handler for event "submit" is undefined.
它看起來對我來說,我的方法關鍵定義makeOffer我應該。這與在實例中定義它不一樣嗎?爲什麼它看不到makeOffer?
你的項目結構是什麼樣的? –
我得到這個錯誤,因爲我沒有關閉我的組件文件中的''標記 –