Open carlo-cocco opened 2 years ago
With the new version of Enso UI we gave up using globals like axios, font awesome, toastr, etc.
Now we need to pass all props for each component.
For components that are used inside Enso we have our wrappers that take care of that
Outside Enso you should always provide all the required props. In your case probably :http="axios"
Thank you, for the 'axios' problem I solved wrapping the vue-table component into another, as the EnsoTable.vue component does. Here's my updated code:
<template>
<vue-table :path="path" id="myTable" :http="this.axios" @ready="ready = true" ref="table">
</vue-table>
</template>
<script>
import Vue from 'vue';
import axios from 'axios';
import VueAxios from 'vue-axios';
import Toastr from '@enso-ui/toastr/bulma';
import ToastrPlugin from '@enso-ui/toastr';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import { VueTable } from '@enso-ui/tables/bulma';
export default {
name: 'EnsoTableComponent',
components: {
FontAwesomeIcon,
VueTable,
axios,
},
props: [
],
data() {
return {
ready: false,
axios,
}
},
methods: {
},
mounted () {
},
computed: {
body() {
return this.ready
? this.$refs.table.body
: null;
},
path() {
return this.$attrs.path
?? `/${`api/${this.$route.path}/initTable`
.split('/').filter(v => v).join('/')}`;
},
slots() {
return this.ready
? this.$refs.table.slots
: [];
},
},
}
Vue.component('fa', FontAwesomeIcon);
Vue.component('vue-table', VueTable);
Vue.use(ToastrPlugin, {
layout: Toastr,
options: {
duration: 3500,
position: 'right',
},
});
Vue.use(VueAxios, axios);
Vue.use(VueTable);
</script>
but now I have another problem:
Uncaught TypeError: this.$slots.default is not a function
render CoreTable.vue:655
Any example code to solve it? Thank you.
This is a bug | feature request.
Prerequisites
Description
When I try to use table component outside of the Enso ecosystem, I have that error:
I don't know if that is a component bug or if I'm use it wrongly. I'm using Vue 3, that is my code, as documentation suggest to do:
Any help? Thank you in advance.