cpreston321 / nuxt-swiper

Swiper.js for Nuxt
https://www.npmjs.com/package/nuxt-swiper
MIT License
220 stars 10 forks source link

Style order issue when using unocss in nuxt-swiper #104

Closed lxccc812 closed 9 months ago

lxccc812 commented 11 months ago

application:

<Swiper
    :modules="[]"
    :slides-per-view="'auto'"
    :grab-cursor="true"
    :free-mode="true"
    class="w-[calc(100%-20px)] overflow-hidden rd-2.5 py-2.5"
>
    <SwiperSlide v-for="item in screenshots" :key="item.id" class="mr-2 w-a last:mr-0">
        <img
            :src="item.imgSrc"
            class="h-62.5 w-a rd-2.5 bg-[#00000066]"
        />
    </SwiperSlide>
</Swiper>

local: QIKD`6%YOPK%`CLN VPLQFS HCNX`ON2`KYO6~%4@`N QS1

after build: RWL9~Z96{2I3IO87OKA3X_N CNV}JHH2~8}Q`MLJCBCXNIB As a result, the style cannot be displayed as expected.

nuxt-swiper 1.2.2 @unocss/nuxt 0.57.1

Solution Add !important

cpreston321 commented 9 months ago

I would use the @apply directive within unocss. This way you can target the swiper-class within the css that can overwrite the default styles. https://unocss.dev/transformers/directives#usage or you can use the unocss important modifier !py.-2.5

lxccc812 commented 9 months ago

yeah , ! is right image