Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(NcActions): use new slots api #5118

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 1 addition & 13 deletions src/mixins/actionGlobal.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
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()
},
Expand All @@ -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() : ''
},
},
}