Skip to content

Commit

Permalink
chore(demo): remove createComponent (#2668)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu authored Nov 18, 2023
1 parent 0b9a640 commit 2f8bec9
Show file tree
Hide file tree
Showing 82 changed files with 2,154 additions and 2,478 deletions.
4 changes: 1 addition & 3 deletions scripts/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,15 @@ export default create({
<script setup lang="ts">
import { defineComponent } from 'vue';
import { createComponent } from '@/packages/utils/create';
const { translate } = createComponent('${nameLc}');
import { useTranslate } from '@/sites/assets/util/useTranslate';
const initTranslate = () => useTranslate({
const translate = useTranslate({
'zh-CN': {
basic: '基础用法'
},
'en-US': {
basic: 'Basic Usage'
}
})
initTranslate();
</script>
`,
taroDemo: `<template>
Expand Down
76 changes: 36 additions & 40 deletions src/packages/__VUE/actionsheet/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,54 +58,50 @@
import { computed, reactive } from 'vue';
import NutActionSheet from './index.vue';
import NutCell from '../cell/index.vue';
import { createComponent } from '@/packages/utils/create';
const { translate } = createComponent('action-sheet');
import { useTranslate } from '@/sites/assets/util/useTranslate';
const initTranslate = () =>
useTranslate({
'zh-CN': {
basic: '基础用法',
showCancelButton: '展示取消按钮',
showDescription: '展示描述信息',
optionStatus: '选项状态',
customContent: '自定义内容',
cancelTxt: '取消',
title: '标题',
optionOne: '选项一',
optionTwo: '选项二',
optionThree: '选项三',
showDesc: '这是一段描述信息',
checkOption: '选中选项',
desc: '描述信息',
disableOption: '禁用选项',
loadOptions: '加载选项'
},
'en-US': {
basic: 'Basic Usage',
showCancelButton: 'Show Cancel Button',
showDescription: 'Show Description',
optionStatus: 'Option Status',
customContent: 'Custom Content',
cancelTxt: 'cancle',
title: 'title',
optionOne: 'option one',
optionTwo: 'option two',
optionThree: 'option three',
showDesc: 'This is a description',
checkOption: 'Check option',
desc: 'Description',
disableOption: 'Disable option',
loadOptions: 'Load options'
}
});
const translate = useTranslate({
'zh-CN': {
basic: '基础用法',
showCancelButton: '展示取消按钮',
showDescription: '展示描述信息',
optionStatus: '选项状态',
customContent: '自定义内容',
cancelTxt: '取消',
title: '标题',
optionOne: '选项一',
optionTwo: '选项二',
optionThree: '选项三',
showDesc: '这是一段描述信息',
checkOption: '选中选项',
desc: '描述信息',
disableOption: '禁用选项',
loadOptions: '加载选项'
},
'en-US': {
basic: 'Basic Usage',
showCancelButton: 'Show Cancel Button',
showDescription: 'Show Description',
optionStatus: 'Option Status',
customContent: 'Custom Content',
cancelTxt: 'cancle',
title: 'title',
optionOne: 'option one',
optionTwo: 'option two',
optionThree: 'option three',
showDesc: 'This is a description',
checkOption: 'Check option',
desc: 'Description',
disableOption: 'Disable option',
loadOptions: 'Load options'
}
});
interface Item {
name: string;
subname?: string;
color?: string;
disable?: boolean;
loading?: boolean;
}
initTranslate();
const state = reactive({
isVisible1: false,
isVisible2: false,
Expand Down
4 changes: 1 addition & 3 deletions src/packages/__VUE/addresslist/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@
</template>

<script setup lang="ts">
import { createComponent } from '@/packages/utils/create';
import { reactive, ref } from 'vue';
const { translate } = createComponent('address-list');
import { useTranslate } from '@/sites/assets/util/useTranslate';
useTranslate({
const translate = useTranslate({
'zh-CN': {
basic: '基础用法',
title1: '长按功能',
Expand Down
78 changes: 37 additions & 41 deletions src/packages/__VUE/animate/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,49 +86,45 @@
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { createComponent } from '@/packages/utils/create';
const { translate } = createComponent('animate');
import { useTranslate } from '@/sites/assets/util/useTranslate';
const initTranslate = () =>
useTranslate({
'zh-CN': {
show: '通过 show 控制动画',
once: '单次动画',
times: '多次触发',
basic: '循环动画',
click: '点击触发',
FRTL: '由右向左划入',
FLTR: '由左向右划入',
FTTB: '由上至下划入',
FBTT: '由下至上划入',
shake: 'shake-抖动',
ripple: 'ripple-心跳',
breath: 'breath-呼吸灯',
twinkle: 'twinkle-水波',
flicker: 'flicker-擦亮',
jump: 'jump-跳跃',
float: 'float-漂浮'
},
'en-US': {
show: 'Trigger animation through show',
once: 'Once',
times: 'Several times',
basic: 'Loop animation',
FRTL: 'From right to left',
FLTR: 'From left to right',
FTTB: 'From top to bottom',
FBTT: 'From bottom to top',
shake: 'shake',
ripple: 'ripple',
breath: 'breath',
twinkle: 'twinkle',
flicker: 'flicker',
jump: 'jump',
float: 'float'
}
});
initTranslate();
const translate = useTranslate({
'zh-CN': {
show: '通过 show 控制动画',
once: '单次动画',
times: '多次触发',
basic: '循环动画',
click: '点击触发',
FRTL: '由右向左划入',
FLTR: '由左向右划入',
FTTB: '由上至下划入',
FBTT: '由下至上划入',
shake: 'shake-抖动',
ripple: 'ripple-心跳',
breath: 'breath-呼吸灯',
twinkle: 'twinkle-水波',
flicker: 'flicker-擦亮',
jump: 'jump-跳跃',
float: 'float-漂浮'
},
'en-US': {
show: 'Trigger animation through show',
once: 'Once',
times: 'Several times',
basic: 'Loop animation',
FRTL: 'From right to left',
FLTR: 'From left to right',
FTTB: 'From top to bottom',
FBTT: 'From bottom to top',
shake: 'shake',
ripple: 'ripple',
breath: 'breath',
twinkle: 'twinkle',
flicker: 'flicker',
jump: 'jump',
float: 'float'
}
});
const show1 = ref(false);
const onClick1 = () => {
Expand Down
32 changes: 14 additions & 18 deletions src/packages/__VUE/audio/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,23 @@
import { ref, onMounted } from 'vue';
import NutAudio from './index.vue';
import NutAudioOperate from '../audiooperate/index.vue';
import { createComponent } from '@/packages/utils/create';
const { translate } = createComponent('audio');
import { useTranslate } from '@/sites/assets/util/useTranslate';
import { PlayDoubleBack, PlayDoubleForward, PlayStart, PlayStop, Voice } from '@nutui/icons-vue';
const initTranslate = () =>
useTranslate({
'zh-CN': {
basic: '基础用法',
voicePlay: '语音播放',
progress: '进度条展示',
customControl: '自定义操作按钮'
},
'en-US': {
basic: 'Basic Usage',
voicePlay: 'Voice Playing',
progress: 'Progress',
customControl: 'Custom Control'
}
});
const translate = useTranslate({
'zh-CN': {
basic: '基础用法',
voicePlay: '语音播放',
progress: '进度条展示',
customControl: '自定义操作按钮'
},
'en-US': {
basic: 'Basic Usage',
voicePlay: 'Voice Playing',
progress: 'Progress',
customControl: 'Custom Control'
}
});
initTranslate();
const audioDemo = ref({
second: 0
});
Expand Down
56 changes: 26 additions & 30 deletions src/packages/__VUE/avatar/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,38 +133,34 @@
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { createComponent } from '@/packages/utils/create';
const { translate } = createComponent('cell');
import { useTranslate } from '@/sites/assets/util/useTranslate';
import { My } from '@nutui/icons-vue';
const initTranslate = () =>
useTranslate({
'zh-CN': {
title1: '支持三种尺寸:large、normal、small',
title2: '支持两种形状:square、round',
title3: '支持三种类型:图片、Icon 以及字符',
title4: 'Icon 和字符型可以自定义颜色及背景色',
title5: '带徽标的头像',
title6: '头像组合展现',
title7: '组合头像可控制层级方向',
title8: '点击头像触发事件',
title9: '动态添加头像',
add: '添加'
},
'en-US': {
title1: 'Support three sizes:small、normal、large',
title2: 'Support two shapes:square、round',
title3: 'Support three types:picture、icon、letter',
title4: 'Icon and letter types can have custom colors and background colors',
title5: 'Avatar with badge',
title6: 'Avatar group display',
title7: 'Avatar group to control hierarchy direction',
title8: 'Click on the avatar to trigger the event',
title9: 'Dynamically adding avatars',
add: 'add'
}
});
initTranslate();
const translate = useTranslate({
'zh-CN': {
title1: '支持三种尺寸:large、normal、small',
title2: '支持两种形状:square、round',
title3: '支持三种类型:图片、Icon 以及字符',
title4: 'Icon 和字符型可以自定义颜色及背景色',
title5: '带徽标的头像',
title6: '头像组合展现',
title7: '组合头像可控制层级方向',
title8: '点击头像触发事件',
title9: '动态添加头像',
add: '添加'
},
'en-US': {
title1: 'Support three sizes:small、normal、large',
title2: 'Support two shapes:square、round',
title3: 'Support three types:picture、icon、letter',
title4: 'Icon and letter types can have custom colors and background colors',
title5: 'Avatar with badge',
title6: 'Avatar group display',
title7: 'Avatar group to control hierarchy direction',
title8: 'Click on the avatar to trigger the event',
title9: 'Dynamically adding avatars',
add: 'add'
}
});
const handleClick = () => {
console.log('Click Test');
};
Expand Down
12 changes: 4 additions & 8 deletions src/packages/__VUE/backtop/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@

<script setup lang="ts">
import NutBacktop from './index.vue';
import { createComponent } from '@/packages/utils/create';
const { translate } = createComponent('backtop');
import { useTranslate } from '@/sites/assets/util/useTranslate';
import { Top } from '@nutui/icons-vue';
const initTranslate = () =>
useTranslate({
'zh-CN': { title: '基础用法', clg: '触发返回顶部', content: '我是测试数据', backText: '顶部' },
'en-US': { title: 'Basic Usage', clg: 'backtop', content: 'test data', backText: 'Top' }
});
initTranslate();
const translate = useTranslate({
'zh-CN': { title: '基础用法', clg: '触发返回顶部', content: '我是测试数据', backText: '顶部' },
'en-US': { title: 'Basic Usage', clg: 'backtop', content: 'test data', backText: 'Top' }
});
const handleClick = () => {
console.log(translate('clg'));
};
Expand Down
40 changes: 18 additions & 22 deletions src/packages/__VUE/badge/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,26 @@
</template>

<script setup lang="ts">
import { createComponent } from '@/packages/utils/create';
const { translate } = createComponent('badge');
import { useTranslate } from '@/sites/assets/util/useTranslate';
import { Check, Download, Link as IconLink } from '@nutui/icons-vue';
const initTranslate = () =>
useTranslate({
'zh-CN': {
title: '基础用法',
title1: '最大值',
title2: '自定义颜色',
title3: '自定义徽标内容',
title4: '自定义位置',
title5: '独立展示'
},
'en-US': {
title: 'Basic Usage',
title1: 'Max',
title2: 'Custom Color',
title3: 'Custom Content',
title4: 'Custom Position ',
title5: 'Standalone'
}
});
initTranslate();
const translate = useTranslate({
'zh-CN': {
title: '基础用法',
title1: '最大值',
title2: '自定义颜色',
title3: '自定义徽标内容',
title4: '自定义位置',
title5: '独立展示'
},
'en-US': {
title: 'Basic Usage',
title1: 'Max',
title2: 'Custom Color',
title3: 'Custom Content',
title4: 'Custom Position ',
title5: 'Standalone'
}
});
</script>

<style lang="scss" scoped>
Expand Down
4 changes: 1 addition & 3 deletions src/packages/__VUE/barrage/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@

<script setup lang="ts">
import { ref } from 'vue';
import { createComponent } from '@/packages/utils/create';
const { translate } = createComponent('barrage');
import { useTranslate } from '@/sites/assets/util/useTranslate';
useTranslate({
const translate = useTranslate({
'zh-CN': {
basic: '基础用法',
slotTitle: 'slot 用法',
Expand Down
Loading

0 comments on commit 2f8bec9

Please sign in to comment.