slot seems not working in ui5-table ui5-page
Dear UI5 Component Team,
I am using UI5 Component in Vue Framework to do some demos.
Here I find the slot is not working well in some component
My Vue version is __
"eslint-plugin-vue": "^7.14.0",
"vue": "^3.0.0",
The eslint will tell me not use 'slot' because it is deprecated, so I replace 'slot' with 'v-slot', ui5-table code snippet like below:

v-slot:columns doesn't work, the render will be blank column header, refer

Could you guide on this please? Does this slots in UI5 components work only before Vue version 2.6.0 (this is the version the v-slot released)?
@MisherLiu
This is a conflict between slot attribute for vue components and webcomponents. slot is deprecated for vue components, but necessary for webcomponents.
The following eslintrc.js config should work:
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'eslint:recommended',
],
parserOptions: {
ecmaVersion: 2020
},
rules: {
'vue/no-deprecated-slot-attribute': 'off',
}
}
Use slot attribute for webcomponents
<div slot="columns">
<ui5-table-column>
....
</ui5-table-column>
</div>
Thanks for your feedback. I still got the error while compling the code. The page is working now, however the css style looks weird. I have to add style to adjust table column and row width.
Thanks BR Misher
Hello @MisherLiu to help you with the styles issue, please provide us an environment to look at and investigate - URL to an app, or you can create small Vue 3 app using https://codesandbox.io/
Ok. Give me some time, I will organize codes.
BTW, another issue is while using ui5-page, the height and width is 00, ui5-page cannot be expanded by the content in it.

@MisherLiu Did you set height to the page's container, body, html?
@MisherLiu
If you are still getting slot validation errors you are probably getting a conflict from vetur. Turning off vetur template validation (eslint-plugin-vue still validates the template) should do the trick

@MisherLiu Did you set height to the page's container, body, html?
I thought ui5-page would be expand by content, so no height and width are set. But I use it, so I set the height and width now. considering the adpation on different screen or different equipment like mobile/tablet/desktop, how is this ui5-page suitable?
@MisherLiu
If you are still getting slot validation errors you are probably getting a conflict from vetur. Turning off vetur template validation (eslint-plugin-vue still validates the template) should do the trick
Yes , I turn off this. It works now. However the css looks strange
@ilhan007 I have serveral question on some components, do I need create another issue or still use this one?
Here @ilhan007 I have several question:
- ui5-page must give a fixed height, for example 580px, this is not suitable for adaptiong on different device
- ui5-input cannot use v-model have a bi-direction binding
- no a component like SAPUI5 form which can contain several label with input in a consistent style , now have to add extra CSS to have a consitent style.
- ui5-table have no sort or rowaction properties. Please refer the sandbox here: https://codesandbox.io/s/vigorous-kepler-d03t9?file=/src/components/HelloWorld.vue
@MisherLiu
ui5-page must give a fixed height, for example 580px, this is not suitable for adaptiong on different device
in your css set html, body and vue mounting point (usually div with id="app") to height: 100%. There is no need for fixed height
ui5-input cannot use v-model have a bi-direction binding
2 way binding via v-model in vue has never worked for custom webcomponents, only for vue components and native html.
Additionally v-model has undergone breaking changes for vue3. see here
for v-bind to work the ui5-input component would have to emit a 'update:value' event, which is obviously not going to happen since it's very specific to vue3 see here
to get 2 way databinding you can use the following
<ui5-input
:value="personDetail.name"
@input="personDetail.name = $event.target.value">
</ui5-input>
I modified your sandbox example for 2way databinding
If you don't like having to write 2 lines to get 2way databinding you can create your own custom directive to get 2way binding. see here (example uses vue2.x)
You will have to adapt the directive code to vue3 as it introduced breaking changes to the directive api.
@MisherLiu
ui5-page must give a fixed height, for example 580px, this is not suitable for adaptiong on different device
in your css set html, body and vue mounting point (usually div with id="app") to height: 100%. There is no need for fixed height The height 100% doesn't work here, please look code in sandbox https://codesandbox.io/s/vigorous-kepler-d03t9?file=/src/App.vue
ui5-input cannot use v-model have a bi-direction binding
2 way binding via v-model in vue has never worked for custom webcomponents, only for vue components and native html.
Additionally v-model has undergone breaking changes for vue3. see here
for v-bind to work the ui5-input component would have to emit a 'update:value' event, which is obviously not going to happen since it's very specific to vue3 see here
to get 2 way databinding you can use the following
<ui5-input :value="personDetail.name" @input="personDetail.name = $event.target.value"> </ui5-input>I modified your sandbox example for 2way databinding
If you don't like having to write 2 lines to get 2way databinding you can create your own custom directive to get 2way binding. see here (example uses vue2.x)
You will have to adapt the directive code to vue3 as it introduced breaking changes to the directive api.
@phipsalabim Thanks for your feedback, as you suggest, I use @input to implement the 2way databinding. For the ui5-page, The height 100% doesn't work here, please look code in sandbox https://codesandbox.io/s/vigorous-kepler-d03t9?file=/src/App.vue
I also face an issue which the ui5-table No Data property doesn't work in my local code, I cannot reproduce it in sandbox. however the code seems no different local code: <ui5-table id="myTblGrowsOnScroll" ref="myUi5Table" no-data-text="Empty Data"
<ui5-table-column demandPopin="true" popinText="Name" style="width: 10%">
<span>Name</span>
<ui5-icon
id="idSortIcon"
class="sortIconStyle locateIcon"
:style="ascIconObject"
name="sort-ascending"
show-tooltip
@click="handleSortClick"
></ui5-icon>
<ui5-icon
id="idSortDesIcon"
class="sortIconStyle locateIcon"
:style="descIconObject"
name="sort-descending"
show-tooltip
@click="handleSortClick"
></ui5-icon>
<ui5-popover id="idSortPopover">
<div>
<div>
<ui5-list>
<ui5-li icon="sort-ascending" @click="handleAscSort"
>Sort Ascending</ui5-li
>
<ui5-li icon="sort-descending" @click="handleDescSort"
>Sort Descending</ui5-li
>
</ui5-list>
</div>
</div>
</ui5-popover>
</ui5-table-column>
<ui5-table-column demandPopin="true" popinText="Email" style="width: 20%">
<span>Email</span>
</ui5-table-column>
<ui5-table-column
demandPopin="true"
popinText="Birth Date"
style="width: 20%"
>
<span>Birth Date</span>
</ui5-table-column>
<ui5-table-column demandPopin="true" popinText="Phone" style="width: 20%">
<span>Phone</span>
</ui5-table-column>
<ui5-table-column demandPopin="true" popinText="Country" style="width: 20%">
<span>Country</span>
</ui5-table-column>
<ui5-table-column demandPopin="true" popinText="Actions" style="width: 10%">
</ui5-table-column>
<ui5-table-row
v-for="item in visibleItems"
:guid="item.id"
:key="item.id"
style="text-align: left"
>
<template v-for="(value, index) in item" :key="value">
<ui5-table-cell v-if="index !== 'id'">
{{ value }}
</ui5-table-cell>
</template>
<ui5-icon
class="actionIconStyle"
:guid="item.id"
style="padding-right: 1rem; padding-left: 1rem"
name="feeder-arrow"
show-tooltip
v-on:click="handleNavTo"
></ui5-icon>
<ui5-icon
class="actionIconStyle"
:guid="item.id"
name="delete"
show-tooltip
@click="handleDelete"
></ui5-icon>
</ui5-table-row>
Hello @MisherLiu,
Are the mentioned issues in your latest comment still relevant?
For the ui5-page, its height is set to 100% which means that the page takes the whole height of it's parent. You have to set height: 100% to both html element and the body or page's container, since the page takes 100% of nothing in other case. For the ui5-table, is the issue still reproducible because I was not able to reproduce it?
Kind Regards, Niya
Hello, everyone! The issue has been inactive for 21 days. If there are still questions or comments, please feel free to continue the discussion. Inactive issues will be closed after 7 days!
Hello, everyone! The issue has been inactive for 28 days, so I am closing the issue.