Skip to content

Commit

Permalink
feat: cell add desc slot(jdf2e#2503)
Browse files Browse the repository at this point in the history
  • Loading branch information
yi-boide committed Sep 11, 2023
1 parent 8034b3d commit cd1481c
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 5 deletions.
7 changes: 7 additions & 0 deletions packages/nutui-taro-demo/src/basic/pages/cell/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
</template>
</nut-cell>

<h2>直接使用插槽(slot desc)</h2>
<nut-cell title="我是标题">
<template #desc>
<span>描述文字 <b style="color: red">2</b></span>
</template>
</nut-cell>

<!-- <nut-cell-group title="链接 | 分组用法">
<nut-cell title="链接" is-link></nut-cell>
<nut-cell
Expand Down
8 changes: 8 additions & 0 deletions src/packages/__VUE/cell/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
</template>
</nut-cell>

<h2>{{ translate('title10') }}</h2>
<nut-cell :title="translate('title')">
<template #desc>
<span>{{ translate('desc') }} <b style="color: red">2</b></span>
</template>
</nut-cell>

<nut-cell-group :title="translate('title5')" :desc="translate('desc1')">
<nut-cell :title="translate('link')" is-link></nut-cell>
<nut-cell :title="translate('urlJump')" desc="https://m.jd.com" is-link url="https://m.jd.com"></nut-cell>
Expand Down Expand Up @@ -92,6 +99,7 @@ const initTranslate = () =>
title7: '垂直居中',
title8: '直接使用插槽(slot title)',
title9: '尺寸设置 large',
title10: '直接使用插槽(slot desc)',
link: '链接',
urlJump: 'URL 跳转',
routerJump: '路由跳转 ’/‘ ',
Expand Down
16 changes: 16 additions & 0 deletions src/packages/__VUE/cell/doc.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,22 @@ const click = () => {

:::

### Use Slots desc

:::demo

```vue
<template>
<nut-cell title="Title">
<template #desc>
<span>Desc <b style="color: red">2</b></span>
</template>
</nut-cell>
</template>
```

:::

### Link | CellGroup Usage

:::demo
Expand Down
16 changes: 16 additions & 0 deletions src/packages/__VUE/cell/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,22 @@ const click = () => {

:::

### 直接使用插槽(slot desc)

:::demo

```vue
<template>
<nut-cell title="我是标题">
<template #desc>
<span>描述文字 <b style="color: red">2</b></span>
</template>
</nut-cell>
</template>
```

:::

### 链接 | 分组用法

:::demo
Expand Down
22 changes: 19 additions & 3 deletions src/packages/__VUE/cell/doc.taro.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,25 @@ const click = () => {

```vue
<template>
<nut-cell desc="描述文字">
<template #title>
<span>Title <b style="color: red">1</b></span>
<nut-cell title="描述文字">
<template #desc>
<span>描述文字 <b style="color: red">1</b></span>
</template>
</nut-cell>
</template>
```

:::

### 直接使用插槽(slot desc)

:::demo

```vue
<template>
<nut-cell title="我是标题">
<template #desc>
<span>描述文字 <b style="color: red">2</b></span>
</template>
</nut-cell>
</template>
Expand Down
8 changes: 6 additions & 2 deletions src/packages/__VUE/cell/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
</slot>
</template>
</view>
<view v-if="desc" class="nut-cell__value"
<view v-if="desc || $slots.desc" class="nut-cell__value"
:class="{ 'nut-cell__value--alone': (!title && !subTitle && !$slots.title) }"
:style="{ 'text-align': descTextAlign }">{{ desc }}</view>
:style="{ 'text-align': descTextAlign }">
<slot name="desc">
{{ desc }}
</slot>
</view>
<slot name="link">
<Right v-if="isLink || to" class="nut-cell__link"></Right>
</slot>
Expand Down

0 comments on commit cd1481c

Please sign in to comment.