我需要这样在index.html中输入两个文本:
<div style="margin-top:50px" class="text-right">
Version: <b>${display_version}</b> - Release:<b>${buildNumber}</b>
</div>
但是当我执行我的应用程序时,我收到错误消息:
Template execution failed: ReferenceError: buildNumber is not defined
ReferenceError: buildNumber is not defined
- index.html:4 eval
[.]/[html-webpack-plugin]/lib/loader.js!./public/index.html:4:10
- index.html:7 module.exports
[.]/[html-webpack-plugin]/lib/loader.js!./public/index.html:7:3
- index.js:284 Promise.resolve.then
[cotador-vida-global-frontend]/[html-webpack-plugin]/index.js:284:18
- next_tick.js:189 process._tickCallback
internal/process/next_tick.js:189:7
如何将这句话(${display_version} / ${buildNumber}
)放在vuejs中?
答案 0 :(得分:0)
我相信,您必须初始化这些变量。
new Vue({
el: '#app',
data: {
display_version:"123",
buildNumber: "456"
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<div style="margin-top:50px" class="text-right">
Version: <b>{{display_version}}</b> - Release:<b>{{buildNumber}}</b>
</div>
</div>