Static GitHub Issues

[1741] data context for handlebars template

prev: How add Authorization token in axios header?
next: Async data in layout?

here is the sample i tried to get handlebars working:

<template lang="handlebars">
    <div class="text-center">
    <h1>{{title}}</h1>
    <div>
        {{data}}
    </div>
    </div>
</template>

<script>
  export default {
    data () {
      return {
        title: 'HBS DEMO',
        body: 'This is the body'
      }
  }
</script>

before i did run npm i handlebars handlebars-loader to install dependencies

it compiles and renders, but without data. data is not bound correctly. The context passed to handlebars template is ['handlebars', 'html', '..path to vue file...\xxx.vue']. Seems it is just a matter of passing right context to template

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1563">#c1563</a>)</em></sub></div>