我有一個簡單的「Hello World」 VueJS的應用程序,我試圖讓工作:Vue公司的應用程序不會加載
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="https://unpkg.com/vue"></script>
</head>
<body>
<div id="app">
Message: {{ message }}
</div>
<script>
var vm = new Vue({
el: "#app",
data: {
message: "Hello, world"
}
});
</script>
</body>
</html>
當我加載在瀏覽器中該文件,關閉我的本地磁盤(即:file:///home/user/vue-project/index.html),它會加載並顯示「Hello,world」。但是,如果我嘗試使用相同的文件並通過python容器開發服務器或通過gunicorn提供服務,則{{message}}呈現爲空白。
有誰知道什麼可能導致這種情況發生?
你也許忘了gunicorn使用線程?變量並不總是通過gunicorn共享的! – Luke
燒瓶使用'{{'和'}}來渲染變量....你需要配置vue來使用'[[message]]' –