docs(Steps): use composition api

This commit is contained in:
chenjiahan 2020-12-13 12:53:18 +08:00
parent f93e21a099
commit 192697de0d
4 changed files with 54 additions and 46 deletions

View File

@ -21,7 +21,7 @@
</demo-block>
</template>
<script>
<script lang="ts">
import { ref } from 'vue';
import { useTranslate } from '@demo/use-translate';

View File

@ -25,11 +25,12 @@ app.use(Steps);
```
```js
import { ref } from 'vue';
export default {
data() {
return {
active: 1,
};
steup() {
const active = ref(1);
return { active };
},
};
```

View File

@ -31,11 +31,12 @@ app.use(Steps);
```
```js
import { ref } from 'vue';
export default {
data() {
return {
active: 1,
};
steup() {
const active = ref(1);
return { active };
},
};
```

View File

@ -42,47 +42,53 @@
</demo-block>
</template>
<script>
<script lang="ts">
import { ref } from 'vue';
import { useTranslate } from '@demo/use-translate';
const i18n = {
'zh-CN': {
nextStep: '下一步',
step1: '买家下单',
step2: '商家接单',
step3: '买家提货',
step4: '交易完成',
title2: '描述信息',
title3: '竖向步骤条',
status1: '【城市】物流状态1',
status2: '【城市】物流状态',
status3: '快件已发货',
customStyle: '自定义样式',
},
'en-US': {
nextStep: 'Next Step',
step1: 'Step1',
step2: 'Step2',
step3: 'Step3',
step4: 'Step4',
title2: 'Description',
title3: 'Vertical Steps',
status1: '【City】Status1',
status2: '【City】Status2',
status3: '【City】Status3',
customStyle: 'Custom Style',
},
};
export default {
i18n: {
'zh-CN': {
nextStep: '下一步',
step1: '买家下单',
step2: '商家接单',
step3: '买家提货',
step4: '交易完成',
title2: '描述信息',
title3: '竖向步骤条',
status1: '【城市】物流状态1',
status2: '【城市】物流状态',
status3: '快件已发货',
customStyle: '自定义样式',
},
'en-US': {
nextStep: 'Next Step',
step1: 'Step1',
step2: 'Step2',
step3: 'Step3',
step4: 'Step4',
title2: 'Description',
title3: 'Vertical Steps',
status1: '【City】Status1',
status2: '【City】Status2',
status3: '【City】Status3',
customStyle: 'Custom Style',
},
},
setup() {
const t = useTranslate(i18n);
const active = ref(1);
data() {
return {
active: 1,
const nextStep = () => {
active.value = ++active.value % 4;
};
},
methods: {
nextStep() {
this.active = ++this.active % 4;
},
return {
t,
active,
nextStep,
};
},
};
</script>