This commit is contained in:
2026-01-05 12:47:14 +08:00
commit 1fc846fae3
1614 changed files with 162035 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
.nut-theme-dark {
.nut-side-navbar-item {
background-color: $dark-background2;
&__title {
color: $dark-color;
background-color: $dark-background2;
}
}
}
.nut-side-navbar-item {
display: block;
height: $sidenavbar-item-height;
font-size: $sidenavbar-item-font-size;
line-height: $sidenavbar-item-line-height;
background-color: $sidenavbar-item-title-bg-color;
&__title {
color: $sidenavbar-item-title-color;
background-color: $sidenavbar-item-title-bg-color;
}
}

View File

@@ -0,0 +1 @@
export * from './sidenavbaritem'

View File

@@ -0,0 +1,23 @@
import type { ExtractPropTypes } from 'vue'
import { CLICK_EVENT } from '../_constants'
import { commonProps } from '../_utils'
export const sidenavbaritemProps = {
...commonProps,
/**
* @description 导航标题
*/
title: String,
/**
* @description 导航唯一标识
*/
ikey: String,
}
export type SideNavbaritemProps = ExtractPropTypes<typeof sidenavbaritemProps>
export const sidenavbaritemEmits = {
[CLICK_EVENT]: () => true,
}
export type SideNavbaritemEmits = typeof sidenavbaritemEmits

View File

@@ -0,0 +1,58 @@
<script setup lang="ts">
import { computed, defineComponent } from 'vue'
import { CLICK_EVENT, PREFIX } from '../_constants'
import { useInject } from '../_hooks'
import { getMainClass, getMainStyle } from '../_utils'
import type { SidenavbarProps } from '../sidenavbar'
import { SIDEN_NAVBAR_KEY } from '../sidenavbar'
import { sidenavbaritemEmits, sidenavbaritemProps } from './sidenavbaritem'
const props = defineProps(sidenavbaritemProps)
const emit = defineEmits(sidenavbaritemEmits)
const classes = computed(() => {
return getMainClass(props, componentName)
})
const Parent = useInject<{ props: Required<SidenavbarProps> }>(SIDEN_NAVBAR_KEY)
const styles = computed(() => {
return getMainStyle(props, {
paddingLeft: `${Number(Parent.parent?.props?.offset) * 2}px`,
})
})
function handleClick() {
emit(CLICK_EVENT)
}
</script>
<script lang="ts">
const componentName = `${PREFIX}-side-navbar-item`
export default defineComponent({
name: componentName,
options: {
virtualHost: true,
addGlobalClass: true,
styleIsolation: 'shared',
},
})
</script>
<template>
<view
:class="classes"
:style="styles"
:ikey="ikey"
@click.stop="handleClick"
>
<text class="nut-side-navbar-item__title">
{{ title }}
</text>
</view>
</template>
<style lang="scss">
@import './index';
</style>