CSS transform based on conditional class changes not working when using vuejs and tailwind-PHP Chinese Network Q&A
CSS transform based on conditional class changes not working when using vuejs and tailwind
P粉872182023
P粉872182023 2023-08-30 10:21:09
0
1
389

I'm trying to use the tailwind transition class to expand the sidebar< ;/code> Submenu component.

// template 
{{ link.label }}
// This is the funny line...
{{ sublink.label }}

The expected behavior is that when link.open becomes true, the defined in the interesting line<

tag/strong> expands (or displays) with a 300 millisecond transition, its height value has been adjusted based on link.sublinks.length Value definitions, all of which apply the sidebar-dropdown-menu CSS class. What I mean is:

.sidebar-dropdown-menu { @apply w-full overflow-hidden transition-[height] duration-[300ms] }

If link.sublinks.length is equal to 3, then the custom class applied will be h-[135px] ; and the

tag in funny line appears, but although the p-0 class works as expected, the conversion doesn't work. Google Chrome Dev Tools shows me height: 135px as a disabled CSS rule.

Finally, if I replace h-[${link.sublinks.length * 45}px] with a constant value (e.g. h-[200px]< /code>) everything works as expected.

I suspect h-auto is overriding my height custom class.

I'm Latin, so my English isn't very good.

Thanks in advance.

P粉872182023
P粉872182023

reply all (1)
P粉211273535

I've made it work, but I don't like the solution I found:

Just avoid using theTailwindclass to define the height attribute, that's it for now.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!