我們正在嘗試構建一個基於瓶子的簡單Web應用程序,並使用SimpleTemplate模塊來模板文件。該網站使用Vue.js構建。Can SimpleTemplate可以忽略模板文件中的變量嗎?
瓶子模板語法是{{}},其中Vue.js also uses for templates。因此,當瓶子試圖通過我們的模板運行模板引擎時,我們將獲得任何Vue.js模板的KeyError異常。
我讀過瓶子SimpleTemplate documentation,和其他人在談論使用SimpleTemplate,但是這還沒有回答我的問題。
HTML包括Vue.js模板變量:
<footer>
<p>© Copyright {{ thisYear }}</p>
</footer>
JavaScript的:
<!-- ROUTING -->
<script>
// Create and mount the root instance.
const app = new Vue({
router,
data: {
parentBaseUrl: '${service_url}/template',
flash: '',
open_menu: [],
thisYear: new Date().getFullYear()
}
以上是的節選HTML和JavaScript來避免轉儲整個文件。
有什麼方法可以配置SimpleTemplate(或另一個瓶模板庫)忽略模板變量?
我試過谷歌搜索,如果我可以以某種方式逃避Vue.js模板變量,所以SimpleTemplate不會取代它們,但我一直沒有找到任何東西。
謝謝,改變Vue.js中的分隔符爲我們解決了它。 – hwmartin