From b94ff0438c47f8005b8e5c5da9b6b045d7733267 Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Tue, 23 Jan 2024 14:04:40 +0100 Subject: [PATCH] fix(NcActions): use new slots api - Since Vue 2.6 with new slots api, it is guaranteed that $scopedSlots has render function for all slots passed any way, while $slots only has value when using deprecated API or short-hand syntax - It also closer to Vue 3 API - `before` method is removed, there is no such lifecycle hook Signed-off-by: Grigorii K. Shartsev --- src/mixins/actionGlobal.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/mixins/actionGlobal.js b/src/mixins/actionGlobal.js index 96015d31a9..86351996ab 100644 --- a/src/mixins/actionGlobal.js +++ b/src/mixins/actionGlobal.js @@ -19,19 +19,7 @@ * along with this program. If not, see . * */ -import Vue from 'vue' - export default { - before() { - // all actions requires a valid text content - // if none, forbid the component mount and throw error - if (!this.$slots.default || this.text.trim() === '') { - Vue.util.warn(`${this.$options.name} cannot be empty and requires a meaningful text content`, this) - this.$destroy() - this.$el.remove() - } - }, - beforeUpdate() { this.text = this.getText() }, @@ -52,7 +40,7 @@ export default { methods: { getText() { - return this.$slots.default ? this.$slots.default[0].text.trim() : '' + return this.$scopedSlots.default ? this.$scopedSlots.default()?.[0].text.trim() : '' }, }, }