Please help me understand how to pass an imported single file vue component inside a vue-grid-layout item.
I know how to pass simple html, like here: https://jsfiddle.net/gmsa/jw2mmmpq/1/ But I need to insert other components with buttons and axios calls, etc
HTML:
<template>
<div class="hello">
<grid-layout
:layout="layout"
:col-num="12"
:row-height="30"
:is-draggable="true"
:is-resizable="true"
:vertical-compact="true"
:margin="[10, 10]"
:use-css-transforms="true"
>
<grid-item v-for="item in layout"
:x="item.x"
:y="item.y"
:w="item.w"
:h="item.h"
:i="item.i">
<div v-html="item.c">
</div>
<Test></Test>
</grid-item>
</grid-layout>
</div>
</template>
JS:
import VueGridLayout from 'vue-grid-layout';
import Test from './test.vue';
import Test from './test2.vue';
let a = `This needs to be another component, like Test`;
let b = `This needs to be another component, like Test2`;
var testLayout = [
{"x":0,"y":0,"w":2,"h":2,"i":"0", "c": a},
{"x":2,"y":0,"w":2,"h":4,"i":"1", "c": b}
];
export default {
name: 'HelloWorld',
props: {
msg: String
},
components: {
GridLayout: VueGridLayout.GridLayout,
GridItem: VueGridLayout.GridItem,
Test,
Test2
},
data: function (){
return {
layout: testLayout
}
}
}
Cannot find any ideas here: