Making Django & Vue.js work together with {% verbatim %}

后端 未结 1 833
臣服心动
臣服心动 2021-01-18 16:32

I\'m trying to make django & Vue work together even though they share the same {{ X }} template syntax.

I know that from django 1.5 we can use the {% verb

相关标签:
1条回答
  • 2021-01-18 16:57

    You can change Vue's interpolation delimiters to whatever you want.

    var sessions = new Vue({
      el: '#sessions',
      delimiters: ['${', '}'],
      data: {
        message: 'Hello Vue!'
      }
    })
    

    That way you can use whatever your framework needs.

    Edit

    It turned out in this case, @Costantin had more than one div#sessions on the page.

    0 讨论(0)
提交回复
热议问题