Skip to content

Commit

Permalink
perf(tab&swipe-item): add class
Browse files Browse the repository at this point in the history
  • Loading branch information
BeADre committed Apr 6, 2022
1 parent 9c97678 commit 7807520
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/varlet-ui/src/swipe-item/SwipeItem.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div
class="var-swipe-item"
:class="n()"
:style="{
width: !vertical ? `${size}px` : undefined,
height: vertical ? `${size}px` : undefined,
Expand All @@ -14,9 +14,12 @@
<script lang="ts">
import { defineComponent, ref } from 'vue'
import { useSwipe } from './provide'
import { createNamespace } from '../utils/components'
import type { Ref } from 'vue'
import type { SwipeItemProvider } from './provide'
const { n } = createNamespace('swipe-item')
export default defineComponent({
name: 'VarSwipeItem',
setup() {
Expand All @@ -36,6 +39,7 @@ export default defineComponent({
bindSwipe(swipeItemProvider)
return {
n,
size,
vertical,
translate,
Expand Down
8 changes: 6 additions & 2 deletions packages/varlet-ui/src/tab/Tab.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<template>
<div
class="var-tab var--box"
:class="classes(n(), 'var--box', computeColorClass(), n(`--${itemDirection}`))"
ref="tabEl"
v-ripple="{ disabled }"
:class="[computeColorClass(), `var-tab--${itemDirection}`]"
:style="{
color: computeColorStyle(),
}"
Expand All @@ -17,10 +16,13 @@
import Ripple from '../ripple'
import { defineComponent, ref, computed, watch } from 'vue'
import { props } from './props'
import { createNamespace } from '../utils/components'
import { useTabs } from './provide'
import type { Ref, ComputedRef } from 'vue'
import type { TabProvider } from './provide'
const { n, classes } = createNamespace('tab')
export default defineComponent({
name: 'VarTab',
directives: { Ripple },
Expand Down Expand Up @@ -77,6 +79,8 @@ export default defineComponent({
watch(() => props.disabled, resize)
return {
n,
classes,
tabEl,
active,
activeColor,
Expand Down

0 comments on commit 7807520

Please sign in to comment.