-
Notifications
You must be signed in to change notification settings - Fork 838
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
273 additions
and
529 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
packages/nutui-taro-demo/src/feedback/pages/switch/async.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<template> | ||
<nut-switch :model-value="val" @change="change" /> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const val = ref(true); | ||
const change = (value) => { | ||
setTimeout(() => { | ||
val.value = value; | ||
}, 2000); | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<nut-switch v-model="val" /> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const val = ref(true); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<nut-switch v-model="val" active-color="skyblue" /> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const val = ref(true); | ||
</script> |
7 changes: 7 additions & 0 deletions
7
packages/nutui-taro-demo/src/feedback/pages/switch/disabled.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<nut-switch v-model="val" disable /> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const val = ref(true); | ||
</script> |
10 changes: 10 additions & 0 deletions
10
packages/nutui-taro-demo/src/feedback/pages/switch/event.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<template> | ||
<nut-switch v-model="val" @change="change" /> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const val = ref(true); | ||
const change = (value) => { | ||
console.log(value); | ||
}; | ||
</script> |
12 changes: 12 additions & 0 deletions
12
packages/nutui-taro-demo/src/feedback/pages/switch/icon.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<template> | ||
<nut-switch v-model="val" loading> | ||
<template #icon> | ||
<Loading name="loading" /> | ||
</template> | ||
</nut-switch> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
import { Loading } from '@nutui/icons-vue-taro'; | ||
const val = ref(true); | ||
</script> |
103 changes: 47 additions & 56 deletions
103
packages/nutui-taro-demo/src/feedback/pages/switch/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,62 @@ | ||
<template> | ||
<Demo> | ||
<h2>基础用法</h2> | ||
<nut-cell> | ||
<nut-switch v-model="data.checked1" /> | ||
</nut-cell> | ||
<h2>{{ t('basic') }}</h2> | ||
<Basic /> | ||
|
||
<h2>禁用状态</h2> | ||
<nut-cell> | ||
<nut-switch v-model="data.checked2" disable /> | ||
</nut-cell> | ||
<h2>{{ t('disabled') }}</h2> | ||
<Disabled /> | ||
|
||
<h2>加载状态</h2> | ||
<nut-cell> | ||
<nut-switch v-model="data.checked3" loading active-color="red" /> | ||
</nut-cell> | ||
<h2>{{ t('loading') }}</h2> | ||
<Loading /> | ||
|
||
<h2>change事件</h2> | ||
<nut-cell> | ||
<nut-switch v-model="data.checked4" @change="change" /> | ||
</nut-cell> | ||
<h2>{{ t('event') }}</h2> | ||
<Event /> | ||
|
||
<h2>异步控制</h2> | ||
<nut-cell> | ||
<nut-switch :model-value="checkedAsync" :loading="loadingAsync" @change="changeAsync" /> | ||
</nut-cell> | ||
<h2>{{ t('async') }}</h2> | ||
<Async /> | ||
|
||
<h2>自定义颜色</h2> | ||
<nut-cell> | ||
<nut-switch v-model="data.checked6" active-color="blue" /> | ||
</nut-cell> | ||
<h2>{{ t('color') }}</h2> | ||
<Color /> | ||
|
||
<h2>支持文字</h2> | ||
<nut-cell> | ||
<nut-switch v-model="data.checked7" active-text="开" inactive-text="关" /> | ||
</nut-cell> | ||
<h2>{{ t('text') }}</h2> | ||
<Text /> | ||
|
||
<h2>自定义加载图标</h2> | ||
<nut-cell> | ||
<nut-switch v-model="data.checked8" loading><Loading name="loading" /></nut-switch> | ||
</nut-cell> | ||
<h2>{{ t('icon') }}</h2> | ||
<IconDemo /> | ||
</Demo> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref, reactive } from 'vue'; | ||
import { Loading } from '@nutui/icons-vue-taro'; | ||
const data = reactive({ | ||
checked1: true, | ||
checked2: true, | ||
checked3: true, | ||
checked4: true, | ||
checked6: true, | ||
checked7: true, | ||
checked8: true | ||
import { useTranslate } from '../../../utils'; | ||
import Basic from './basic.vue'; | ||
import Disabled from './disabled.vue'; | ||
import Loading from './loading.vue'; | ||
import Event from './event.vue'; | ||
import Async from './async.vue'; | ||
import Color from './color.vue'; | ||
import Text from './text.vue'; | ||
import IconDemo from './icon.vue'; | ||
const t = useTranslate({ | ||
'zh-CN': { | ||
basic: '基础用法', | ||
disabled: '禁用状态', | ||
loading: '加载状态', | ||
event: 'Change 事件', | ||
async: '异步控制', | ||
color: '自定义颜色', | ||
text: '支持文字', | ||
icon: '自定义加载图标' | ||
}, | ||
'en-US': { | ||
basic: 'Basic Usage', | ||
disabled: 'Disabled', | ||
loading: 'Loading', | ||
event: 'Change Event', | ||
async: 'Async Control', | ||
color: 'Custom Color', | ||
text: 'Support Text', | ||
icon: 'Custom Loading Icon' | ||
} | ||
}); | ||
const checkedAsync = ref(true); | ||
const loadingAsync = ref(false); | ||
const change = (value: boolean) => { | ||
console.log(`value:${value}`); | ||
}; | ||
const changeAsync = (value: boolean) => { | ||
console.log(`2秒后异步触发 ${value}`); | ||
loadingAsync.value = true; | ||
setTimeout(() => { | ||
checkedAsync.value = value; | ||
loadingAsync.value = false; | ||
}, 2000); | ||
}; | ||
</script> |
7 changes: 7 additions & 0 deletions
7
packages/nutui-taro-demo/src/feedback/pages/switch/loading.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<nut-switch v-model="val" loading active-color="red" /> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const val = ref(true); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<nut-switch v-model="val" active-text="开" inactive-text="关" /> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const val = ref(true); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<template> | ||
<nut-switch :model-value="val" @change="change" /> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const val = ref(true); | ||
const change = (value) => { | ||
setTimeout(() => { | ||
val.value = value; | ||
}, 2000); | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<nut-switch v-model="val" /> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const val = ref(true); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<nut-switch v-model="val" active-color="skyblue" /> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const val = ref(true); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<nut-switch v-model="val" disable /> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const val = ref(true); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<template> | ||
<nut-switch v-model="val" @change="change" /> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const val = ref(true); | ||
const change = (value) => { | ||
console.log(value); | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<template> | ||
<nut-switch v-model="val" loading> | ||
<template #icon> | ||
<Loading name="loading" /> | ||
</template> | ||
</nut-switch> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
import { Loading } from '@nutui/icons-vue'; | ||
const val = ref(true); | ||
</script> |
Oops, something went wrong.