Use moustache inside moustache brackets in vue?

I’m pretty new to Vue.js and love it so far. There’s only one problem I have: How do I render a string AND things inside the string?
For example:

//…
data:{
string:"hi, {{name}}",
name:"John Doe"
}

{{string}}<!—won’t work —>
<span v-html="string"></span><!—neither this —>

14 thoughts on “Use moustache inside moustache brackets in vue?”

  1. Correct syntax for rendering data variables.

    <!DOCTYPE html>
    <html>
    <head>
      
    </head>
    <body>
      <div id="app">
        <h1>Hello {{name}}</h1>
      </div>
    
     <script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
      <script>
        new Vue({
          el: '#app',
          data () {
          return {
            name: "Jim",
          }
        },
        })
      </script>
    </body>
    </html>
    Reply

Leave a Comment