mengxiong10 / vue2-datepicker

A datepicker / datetimepicker component for Vue2
https://mengxiong10.github.io/vue2-datepicker/index.html
MIT License
1.52k stars 407 forks source link

[Bug] Slot icon should not have color modifier #739

Closed mochamadArif closed 1 year ago

mochamadArif commented 1 year ago

Vue2-datepicker version: v3.11.1 Vue version: v2.6.14 Browser: Chrome

Steps to reproduce I use tailwind and custom SVG icon as component.

Reproduction Link or Source Code

<VueDatePicker
  v-model="selectedDate"
  value-type="format"
  class="custom"
  format="DD/MM/YYYY"
  :open.sync="isDatePickerShown"
  :editable="false"
  @change="onChangeDate"
>
  <template #icon-calendar>
    <IconArrowRight
      class="text-primary"
    />
  </template>
</VueDatePicker>

SVG file

<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
  <path
    d="M9 3L18 12L9 21"
    stroke="currentColor"
    stroke-width="3"
    stroke-linecap="round"
  />
</svg>

Expected behavior I expect my icon to show without any color modifier from the slot.

Actual behavior The slot style has .mx-datepicker svg { fill: currentColor; .... }, causing outline only SVG added fill color.

mengxiong10 commented 1 year ago

You can add a class to override the default class.

.mx-datepicker svg { fill: 'none' }

or

  <path
    d="M9 3L18 12L9 21"
    fill="none"
    stroke="currentColor"
    stroke-width="3"
    stroke-linecap="round"
  />