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

[Oruga-next][Vue 3.x] AddonsClass not working on Field component #74

Closed
mllull opened this issue Jan 7, 2021 · 4 comments
Closed

[Oruga-next][Vue 3.x] AddonsClass not working on Field component #74

mllull opened this issue Jan 7, 2021 · 4 comments

Comments

@mllull
Copy link

mllull commented Jan 7, 2021

Overview of the problem

Oruga-next version: [0.2.2]
Vuejs version: [3.0.5]
OS/Browser: Chromium/Firefox

Description

o-field--addons class is not added on Field component because of slot implementation on Vue3.

The problem is here:
oruga/packages/oruga/src/components/field/Field.vue

hasAddons() {
            let renderedNode = 0
            if (this.$slots.default) {
                renderedNode = this.$slots.default.reduce((i, node) => node.tag ? i + 1 : i, 0)
            }
            return (
                renderedNode > 1 &&
                this.addons &&
                !this.horizontal
            )
        }

this.$slots
https://v3.vuejs.org/guide/migration/slots-unification.html

Maybe deep refactoring is required, because Oruga uses lots of slot.

@jtommy
Copy link
Member

jtommy commented Jan 7, 2021

You are watching Vue 2 branch, you should take a look at oruga-next branch.
Btw we are working on new breaking release 0.3.0 and soon I'll update next branch 😉

PS: probably that issue has been fixed

@jtommy jtommy closed this as completed Jan 7, 2021
@mllull
Copy link
Author

mllull commented Jan 8, 2021

I can't see oruga-next branch in GH, but I'm using it on my code (I installed Oruga with yarn add @oruga-ui/oruga-next command).

@jtommy
Copy link
Member

jtommy commented Jan 8, 2021

I meat packages https://www.github.com/oruga-ui/oruga/tree/develop/packages%2Foruga-next

It's working in progress, but probably next week will be available!!

@mllull
Copy link
Author

mllull commented Jan 8, 2021

@jtommy I solved this issue by changing this line:

renderedNode = this.$slots.default().reduce((i: number, node: any) => node.tag ? i + 1 : i, 0)

With this code:

                renderedNode = this.$slots.default().reduce((i: number, node: any) => node.type ? i + 1 : i, 0)

Seems that no more tag attrib in node element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants