getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.32k stars 168 forks source link

[3.6.0-alpha.3] Cannot read property 'componentInstance' of null #3619

Closed afbora closed 3 years ago

afbora commented 3 years ago

Describe the bug

I'mi getting following error in console when i try to set template as view file

TypeError: Cannot read property 'componentInstance' of null

index.js

import View from "./components/View.vue";

panel.plugin('yourname/todos', {
  components: {
    'k-todos-view': {
      props: {
        todos: Array
      },
      template: View
    }
  }
})

View.vue

<template>
  <k-view class="k-todos-view">
    <k-header>
      Todos
    </k-header>
  </k-view>
</template>

<script>
export default {};
</script>

Kirby Version

3.6.0-alpha.3

distantnative commented 3 years ago

Are you using a bundler?

afbora commented 3 years ago

I guess, using parcel: parcel build src/index.js --no-source-maps --experimental-scope-hoisting -d ./

afbora commented 3 years ago

Inline template codes template: '<template>...</template>' working but as view not working template: View

bastianallgeier commented 3 years ago

Your setup is not correct.

It should look like this:

import View from "./components/View.vue";

panel.plugin('yourname/todos', {
  components: {
    'k-todos-view': View
  }
})
<template>
  <k-view class="k-todos-view">
    <k-header>
      Todos
    </k-header>
  </k-view>
</template>

<script>
export default {
  props: {
    todos: Array
  }
};
</script>
afbora commented 3 years ago

Ohh, my incompetence 🙈 Thanks