feat: NavbarCapsule 导航胶囊组件支持外部传入样式

This commit is contained in:
不如摸鱼去 2025-01-24 23:31:53 +08:00
parent 4575099b9b
commit fb980e7d9b
2 changed files with 12 additions and 1 deletions

View File

@ -0,0 +1,8 @@
import type { ExtractPropTypes } from 'vue'
import { baseProps } from '../common/props'
export const navbarCapsuleProps = {
...baseProps
}
export type NavbarCapsuleProps = ExtractPropTypes<typeof navbarCapsuleProps>

View File

@ -1,5 +1,5 @@
<template>
<view class="wd-navbar-capsule">
<view :class="`wd-navbar-capsule ${customClass}`" :style="customStyle">
<wd-icon @click="handleBack" name="chevron-left" custom-class="wd-navbar-capsule__icon" />
<wd-icon @click="handleBackHome" name="home" custom-class="wd-navbar-capsule__icon" />
</view>
@ -17,7 +17,10 @@ export default {
<script lang="ts" setup>
import wdIcon from '../wd-icon/wd-icon.vue'
import { navbarCapsuleProps } from './types'
const emit = defineEmits(['back', 'back-home'])
defineProps(navbarCapsuleProps)
function handleBack() {
emit('back')