Skip to content

Commit

Permalink
chore(ecard): split demo (#2770)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu authored Dec 19, 2023
1 parent 1539734 commit ed3f554
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 223 deletions.
39 changes: 39 additions & 0 deletions packages/nutui-taro-demo/src/business/pages/ecard/basic.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<nut-cell>
<nut-ecard
v-model="money"
:data-list="dataList"
@input-change="inputChange"
@change="change"
@change-step="changeStep"
></nut-ecard>
</nut-cell>
</template>
<script setup lang="ts">
import { ref } from 'vue';
const dataList = ref([
{
price: 10
},
{
price: 20
},
{
price: 30
},
{
price: 40
}
]);
const money = ref(10);
const inputChange = (val: number) => {
money.value = val;
};
const change = (item: any) => {
money.value = item.price;
};
const changeStep = (num: number, price: number) => {
const val = price * num;
money.value = val;
};
</script>
45 changes: 11 additions & 34 deletions packages/nutui-taro-demo/src/business/pages/ecard/index.vue
Original file line number Diff line number Diff line change
@@ -1,42 +1,19 @@
<template>
<Demo>
<h2>基础用法</h2>
<nut-cell>
<nut-ecard
v-model="money"
:data-list="dataList"
@input-change="inputChange"
@change="change"
@change-step="changeStep"
></nut-ecard>
</nut-cell>
<h2>{{ t('basic') }}</h2>
<Basic />
</Demo>
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue';
const dataList = reactive([
{
price: 10
import { useTranslate } from '../../../utils';
import Basic from './basic.vue';
const t = useTranslate({
'zh-CN': {
basic: '基础用法'
},
{
price: 20
},
{
price: 30
},
{
price: 40
'en-US': {
basic: 'Basic Usage'
}
]);
const money = ref(0);
const inputChange = (val: number) => {
money.value = val;
};
const change = (item: { price: number }) => {
money.value = item.price;
};
const changeStep = (num: number, price: number) => {
const val = price * num;
money.value = val;
};
});
</script>
51 changes: 0 additions & 51 deletions src/packages/__VUE/ecard/demo.vue

This file was deleted.

39 changes: 39 additions & 0 deletions src/packages/__VUE/ecard/demo/basic.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<nut-cell>
<nut-ecard
v-model="money"
:data-list="dataList"
@input-change="inputChange"
@change="change"
@change-step="changeStep"
></nut-ecard>
</nut-cell>
</template>
<script setup lang="ts">
import { ref } from 'vue';
const dataList = ref([
{
price: 10
},
{
price: 20
},
{
price: 30
},
{
price: 40
}
]);
const money = ref(10);
const inputChange = (val: number) => {
money.value = val;
};
const change = (item: any) => {
money.value = item.price;
};
const changeStep = (num: number, price: number) => {
const val = price * num;
money.value = val;
};
</script>
19 changes: 19 additions & 0 deletions src/packages/__VUE/ecard/demo/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
<Demo>
<h2>{{ t('basic') }}</h2>
<Basic />
</Demo>
</template>
<script setup lang="ts">
import { useTranslate } from '@/sites/utils';
import Basic from './basic.vue';
const t = useTranslate({
'zh-CN': {
basic: '基础用法'
},
'en-US': {
basic: 'Basic Usage'
}
});
</script>
48 changes: 2 additions & 46 deletions src/packages/__VUE/ecard/doc.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,15 @@ app.use(Ecard);

### Basic

:::demo

```vue
<template>
<nut-cell>
<nut-ecard
v-model="money"
@input-change="inputChange"
@change="change"
@change-step="changeStep"
:data-list="dataList"
></nut-ecard>
</nut-cell>
</template>
<script setup>
import { ref, reactive } from 'vue';
const dataList = reactive([
{
price: 10
},
{
price: 20
},
{
price: 30
},
{
price: 40
}
]);
const money = ref(10);
const inputChange = (val) => {
money.value = val;
};
const change = (item) => {
money.value = item.price;
};
const changeStep = (num, price) => {
const val = price * num;
money.value = val;
};
</script>
```

:::
> demo: ecard basic
## API

### Props

| Attribute | Description | Type | Default |
| --- | --- | --- | --- |
| modelValue | Price | number | `0` |
| model-value | Price | number | `0` |
| choose-text | Main Title | string | `Select` |
| other-value-text | Other Text | string | `Other Value` |
| data-list | Ecard List | Array | `DataList[]` |
Expand Down
48 changes: 2 additions & 46 deletions src/packages/__VUE/ecard/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,15 @@ app.use(Ecard);

### 基础用法

:::demo

```vue
<template>
<nut-cell>
<nut-ecard
v-model="money"
@input-change="inputChange"
@change="change"
@change-step="changeStep"
:data-list="dataList"
></nut-ecard>
</nut-cell>
</template>
<script setup>
import { ref, reactive } from 'vue';
const dataList = reactive([
{
price: 10
},
{
price: 20
},
{
price: 30
},
{
price: 40
}
]);
const money = ref(10);
const inputChange = (val) => {
money.value = val;
};
const change = (item) => {
money.value = item.price;
};
const changeStep = (num, price) => {
const val = price * num;
money.value = val;
};
</script>
```

:::
> demo: ecard basic
## API

### Props

| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| modelValue | 购买电子卡所需价钱 | number | `0` |
| model-value | 购买电子卡所需价钱 | number | `0` |
| choose-text | 选择面值文案 | string | `请选择电子卡面值` |
| other-value-text | 其他面值文案 | string | `其他面值` |
| data-list | 电子卡面值列表 | Array | `DataList[]` |
Expand Down
48 changes: 2 additions & 46 deletions src/packages/__VUE/ecard/doc.taro.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,15 @@ app.use(Ecard);

### 基础用法

:::demo

```vue
<template>
<nut-cell>
<nut-ecard
v-model="money"
@input-change="inputChange"
@change="change"
@change-step="changeStep"
:data-list="dataList"
></nut-ecard>
</nut-cell>
</template>
<script setup>
import { ref, reactive } from 'vue';
const dataList = reactive([
{
price: 10
},
{
price: 20
},
{
price: 30
},
{
price: 40
}
]);
const money = ref(10);
const inputChange = (val) => {
money.value = val;
};
const change = (item) => {
money.value = item.price;
};
const changeStep = (num, price) => {
const val = price * num;
money.value = val;
};
</script>
```

:::
> demo: ecard basic business
## API

### Props

| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| modelValue | 购买电子卡所需价钱 | number | `0` |
| model-value | 购买电子卡所需价钱 | number | `0` |
| choose-text | 选择面值文案 | string | `请选择电子卡面值` |
| other-value-text | 其他面值文案 | string | `其他面值` |
| data-list | 电子卡面值列表 | Array | `DataList[]` |
Expand Down

0 comments on commit ed3f554

Please sign in to comment.