Vue.js uiv 라이브러리의 Tab 구성 요소에 대한 클래스를 설정하는 방법은 무엇입니까? (How to set up classes for Vue.js uiv library's Tab component?)


문제 설명

Vue.js uiv 라이브러리의 Tab 구성 요소에 대한 클래스를 설정하는 방법은 무엇입니까? (How to set up classes for Vue.js uiv library's Tab component?)

우리 프로젝트에서는 uiv 라이브러리를 사용합니다. 탭이 있고 UI를 사용자 정의하고 싶습니다. 문서 내용:

https://uiv.wxsm.space/tabs#tab

예를 들어 어떤 상황에서 탭마다 다른 색상을 사용하기 위해 Tab의 API를 사용하는 방법을 잘 모르겠습니다.

간단히 다음과 같이 시도했습니다.

<tab
  v‑for="(sectionDescription) in tabbedSectionDescriptions"
  :key="sectionDescription.key"
  :title="sectionDescription.displayName"
  :tab‑classes="{ 'paint‑tab': true }"
>

<style lang="stylus" scoped>
>>> .nav‑tabs
  .paint‑tab
    a
      color red
</style>

그러나 모든 탭의 제목이 빨간색으로 칠해져 있는데, 이는 내가 원하는 동작이 아닙니다.


참조 솔루션

방법 1:

You have to define function that return certian class object for certain tab: in template:

:tab‑classes="getTabColorClass(sectionDescription)"

in code:

methods: {
  getTabColorClass(sectionDescription) {
     switch (sectionDescription.key) {
       'key1': 
          return {
           'paint‑tab': true 
          }
       'key2': 
         return {
           'paint‑tab2': true 
         }
       default:
         return null
     }
  }
}

in style:

>>> .nav‑tabs
  .paint‑tab
    a
      color red
  .paint‑tab2
    a
      color green

(by tesicgAnatoly)

참조 문서

  1. How to set up classes for Vue.js uiv library's Tab component? (CC BY‑SA 2.5/3.0/4.0)

#tabs #styles #vue.js






관련 질문

양식 제출 후 현재 탭 유지 (Keeping the current tabs after submitting the form)

슬라이드다운 탭이 예상대로 작동하지 않음 (Slide-down tabs not working as expected)

일부 장치 Android에서 ViewPager가 작동하지 않음 (ViewPager not working on some devices Android)

ScrollView가 조각에서 작동하지 않습니다 (ScrollView doesn't work in fragment)

공백이 많은 줄을 읽고 출력에서 유지 (Reading lines with a lot of spaces and maintaining them in output)

Google지도 조각을 찾을 수 없습니다 (Can't find google maps fragment)

kaldi 설치 시 libmkl_tbb_thread.so sth 관련 문제 (A problem related to libmkl_tbb_thread.so sth when installing kaldi)

링크 클릭 시 새 탭 또는 창에서 특정 링크 열기 (Open specific link in new tab or window on link clicking)

Vue.js uiv 라이브러리의 Tab 구성 요소에 대한 클래스를 설정하는 방법은 무엇입니까? (How to set up classes for Vue.js uiv library's Tab component?)

Foundation 탭이 초기화되었는지 확인하는 방법은 무엇입니까? (How to check if Foundation tabs are initialized?)

고유 참조가 없는 한 HTML 페이지의 여러 탭(ID 또는 클래스 없음) (Multiple tabs in one HTML page without unique reference (no ID or class))

Angular Slickgrid 예제 24에서 Angular slickgrid 및 ngfor를 사용하여 동적으로 탭 만들기 (Dynamically create tabs with Angular slickgrid and ngfor in Angular Slickgrid Example 24)







코멘트