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

How do i change value from a variable in pugjs with javascript? #3426

Open
victor-0x29a opened this issue Feb 2, 2024 · 0 comments
Open

Comments

@victor-0x29a
Copy link

victor-0x29a commented Feb 2, 2024

How do i change the value from a var from pug with javascript?

mixin header(items)
    - var isEnabledDropdown = Boolean(profile?.username)
    - var title = process.env.APP_NAME
    header
        if isEnabledDropdown
            //- +dropdown(items, title)
            - var isOpenedSideSection = false
            nav.row.flex-between.svg-clickable
                h2(onclick="goToHome()").nav-title #{title}
                +hamburguer-icon("40px", "40px", "openSideSection()")
            +side-section(isOpenedSideSection, 'header')
                ul
                    if items
                        for item in items
                            li.common-header-item
                                a(href=item.href) #{item.label}

            script.
                function openSideSection() {
                    console.log(#{isOpenedSideSection}) // <- This work
                    - var isOpenedSideSection = true //  <- Doesnt work :(
                }
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

1 participant