這樣一個網(wǎng)頁<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Title</title> <script src="js/vue.js"></script></head><body><div id="example-2"> <simple-counter></simple-counter> <simple-counter></simple-counter> <simple-counter></simple-counter></div><script> var data = { counter: 0 } Vue.component('simple-counter', { template: '<button v-on:click="counter += 1">{{ counter }}</button>', // 技術(shù)上 data 的確是一個函數(shù)了,因此 Vue 不會警告, // 但是我們卻給每個組件實例返回了同一個對象的引用 data: function () { return data } }); new Vue({ el: '#example-2' })</script></body></html>router中func init() { beego.Router("/arcTest.html", &controllers.ArcTestController{}, "*:Arc")}controller中func (c *ArcTestController) Arc() { c.TplName = "arcTest.html"}單獨運行html頁面沒有任何問題放進beego框架中 bee run一下報錯[E] [template.go:174] parse template err: arcTest.html template: arcTest.html:20: function "counter" not defined[W] [beego.go:97] template: arcTest.html:20: function "counter" not definedpanic: template: arcTest.html:20: function "counter" not definedcounter不能使用,刪去就編譯成功了,但是明明有定義 這個例子就是在vue官網(wǎng)上復(fù)制的,為什么beego就是編譯不過,導(dǎo)致整個項目都運行不起來,有沒有大神知道怎么解決,跪求。
beego框架中使用vue的component 編譯出錯
慕森王
2019-03-12 13:13:50