Static GitHub Issues

[830] Suggested way to integrate Cerebral as alternative store in Nuxt

prev: no hot reload when changing scss file
next: v1.0 plugins: window.onNuxtReady is undefined

I am trying to integrate Cerebral (http://www.cerebraljs.com) as alternative store in Nuxt. The way how to combine Cerebral with Vue ist described here (bottom of the page): http://cerebraljs.com/docs/introduction/view_type.html

I changed /layouts/default.vue in Nuxt as described below. The goal is to wrap the nuxt element with the cerebral container element.

<template>
  <div>
    <container>
      <nuxt/>
    </container>
  </div>
</template>

<script>

import {Controller} from 'cerebral'
import {Container} from 'cerebral/vue'

const controller = Controller({
  state: {
    foo: 'bar',
    mylist: [{ bird: 'eagle' }, { bird: 'owl' }, { bird: 'falcon' }]
  }
})

export default {
  name: 'default',
  components: {
    container: Container(controller)
  }
}
</script>

Obviously this is not working, because I can't export a default element on a nuxt layout page, just a template.

So I wonder, if someone can give me a pointer on how to do this the right way in Nuxt?

<!--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/c713">#c713</a>)</em></sub></div>