Skip to content

Commit

Permalink
docs(collapse): fix translation Error (#12464)
Browse files Browse the repository at this point in the history
  • Loading branch information
RSS1102 committed Nov 22, 2023
1 parent eb8457e commit 941f92d
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 23 deletions.
54 changes: 40 additions & 14 deletions packages/vant/src/collapse/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,16 @@ Use `v-model` to control the name of active panels.

```html
<van-collapse v-model="activeNames">
<van-collapse-item title="Title1" name="1">Content 1</van-collapse-item>
<van-collapse-item title="Title2" name="2">Content 2</van-collapse-item>
<van-collapse-item title="Title3" name="3">Content 3</van-collapse-item>
<van-collapse-item title="Title1" name="1">
The code is written for people to see and can be run on a machine.
</van-collapse-item>
<van-collapse-item title="Title2" name="2">
Technology is nothing more than the common soul of those who develop it.
</van-collapse-item>
<van-collapse-item title="Title3" name="3">
The frequency of people swearing during code reading is the only measure of
code quality.
</van-collapse-item>
</van-collapse>
```

Expand All @@ -48,9 +55,16 @@ In accordion mode, only one panel can be expanded at the same time.

```html
<van-collapse v-model="activeName" accordion>
<van-collapse-item title="Title1" name="1">Content 1</van-collapse-item>
<van-collapse-item title="Title2" name="2">Content 2</van-collapse-item>
<van-collapse-item title="Title3" name="3">Content 3</van-collapse-item>
<van-collapse-item title="Title1" name="1">
The code is written for people to see and can be run on a machine.
</van-collapse-item>
<van-collapse-item title="Title2" name="2">
Technology is nothing more than the common soul of those who develop it.
</van-collapse-item>
<van-collapse-item title="Title3" name="3">
The frequency of people swearing during code reading is the only measure of
code quality.
</van-collapse-item>
</van-collapse>
```

Expand All @@ -71,28 +85,33 @@ Use the `disabled` prop to disable CollapseItem.

```html
<van-collapse v-model="activeNames">
<van-collapse-item title="Title1" name="1">Content 1</van-collapse-item>
<van-collapse-item title="Title1" name="1">
The code is written for people to see and can be run on a machine.
</van-collapse-item>
<van-collapse-item title="Title2" name="2" disabled>
Content 2
Technology is nothing more than the common soul of those who develop it.
</van-collapse-item>
<van-collapse-item title="Title3" name="3" disabled>
Content 3
The frequency of people swearing during code reading is the only measure of
code quality.
</van-collapse-item>
</van-collapse>
```

### Custom title

Using `title` slot to custom title.

```html
<van-collapse v-model="activeNames">
<van-collapse-item name="1">
<template #title>
<div>Title1 <van-icon name="question-o" /></div>
</template>
Content 1
The code is written for people to see and can be run on a machine.
</van-collapse-item>
<van-collapse-item title="Title2" name="2" icon="shop-o">
Content 2
Technology is nothing more than the common soul of those who develop it.
</van-collapse-item>
</van-collapse>
```
Expand All @@ -114,9 +133,16 @@ Using `toggleAll` method to toggle all items.

```html
<van-collapse v-model="activeNames" ref="collapse">
<van-collapse-item title="Title1" name="1">Content 1</van-collapse-item>
<van-collapse-item title="Title2" name="2">Content 2</van-collapse-item>
<van-collapse-item title="Title3" name="3">Content 3</van-collapse-item>
<van-collapse-item title="Title1" name="1">
The code is written for people to see and can be run on a machine.
</van-collapse-item>
<van-collapse-item title="Title2" name="2">
Technology is nothing more than the common soul of those who develop it.
</van-collapse-item>
<van-collapse-item title="Title3" name="3">
The frequency of people swearing during code reading is the only measure of
code quality.
</van-collapse-item>
</van-collapse>

<van-button type="primary" @click="openAll">Open All</van-button>
Expand Down
8 changes: 5 additions & 3 deletions packages/vant/src/collapse/demo/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ const t = useTranslate({
inverse: '全部切换',
},
'en-US': {
text1: 'Content 1',
text2: 'Content 2',
text3: 'Content 3',
text1: 'The code is written for people to see and can be run on a machine.',
text2:
'Technology is nothing more than the common soul of those who develop it.',
text3:
'The frequency of people swearing during code reading is the only measure of code quality.',
accordion: 'Accordion',
titleSlot: 'Custom title',
toggleAll: 'Toggle All',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-collapse-item__wrapper">
<div class="van-collapse-item__content">
<!--[-->
Content 1
The code is written for people to see and can be run on a machine.
</div>
</div>
</div>
Expand Down Expand Up @@ -112,7 +112,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-collapse-item__wrapper">
<div class="van-collapse-item__content">
<!--[-->
Content 1
The code is written for people to see and can be run on a machine.
</div>
</div>
</div>
Expand Down Expand Up @@ -334,7 +334,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-collapse-item__wrapper">
<div class="van-collapse-item__content">
<!--[-->
Content 1
The code is written for people to see and can be run on a machine.
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exports[`should render demo and match snapshot 1`] = `
</div>
<div class="van-collapse-item__wrapper">
<div class="van-collapse-item__content">
Content 1
The code is written for people to see and can be run on a machine.
</div>
</div>
</div>
Expand Down Expand Up @@ -77,7 +77,7 @@ exports[`should render demo and match snapshot 1`] = `
</div>
<div class="van-collapse-item__wrapper">
<div class="van-collapse-item__content">
Content 1
The code is written for people to see and can be run on a machine.
</div>
</div>
</div>
Expand Down Expand Up @@ -227,7 +227,7 @@ exports[`should render demo and match snapshot 1`] = `
</div>
<div class="van-collapse-item__wrapper">
<div class="van-collapse-item__content">
Content 1
The code is written for people to see and can be run on a machine.
</div>
</div>
</div>
Expand Down

0 comments on commit 941f92d

Please sign in to comment.