Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(fixed-nav): split demo #2786

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions packages/nutui-taro-demo/src/nav/pages/fixednav/basic.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<template>
<nut-fixed-nav v-model:visible="visible" :position="{ top: '70px' }" :nav-list="navList" />
</template>
<script setup lang="ts">
import { ref } from 'vue';
const visible = ref(false);
const navList = ref([
{
id: 1,
text: '首页',
icon: 'https://img11.360buyimg.com/imagetools/jfs/t1/117646/2/11112/1297/5ef83e95E81d77f05/daf8e3b1c81e3c98.png'
},
{
id: 2,
text: '分类',
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/119490/8/9568/1798/5ef83e95E968c69a6/dd029326f7d5042e.png'
},
{
id: 3,
text: '购物车',
num: 2,
icon: 'https://img14.360buyimg.com/imagetools/jfs/t1/130725/4/3157/1704/5ef83e95Eb976644f/b36c6cfc1cc1a99d.png'
},
{
id: 4,
text: '我的',
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/147573/29/1603/1721/5ef83e94E1393a678/5ddf1695ec989373.png'
}
]);
</script>
22 changes: 22 additions & 0 deletions packages/nutui-taro-demo/src/nav/pages/fixednav/custom.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<template>
<nut-fixed-nav v-model:visible="visible" :position="{ top: '280px' }" type="left">
<template #list>
<ul class="nut-fixed-nav__list">
<li class="nut-fixed-nav__list-item">1</li>
<li class="nut-fixed-nav__list-item">2</li>
<li class="nut-fixed-nav__list-item">3</li>
<li class="nut-fixed-nav__list-item">4</li>
<li class="nut-fixed-nav__list-item">5</li>
</ul>
</template>
<template #btn>
<Retweet color="#fff" />
<span class="text">{{ visible ? '自定义开' : '自定义关' }}</span>
</template>
</nut-fixed-nav>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { Retweet } from '@nutui/icons-vue-taro';
const visible = ref(false);
</script>
87 changes: 10 additions & 77 deletions packages/nutui-taro-demo/src/nav/pages/fixednav/index.vue
Original file line number Diff line number Diff line change
@@ -1,85 +1,18 @@
<template>
<Demo>
<nut-fixed-nav
v-model:visible="visible"
active-text="基础用法"
:position="{ top: '70px' }"
:nav-list="navList"
@selected="selected"
/>
<nut-fixed-nav
v-model:visible="visible1"
type="left"
:position="{ top: '140px' }"
active-text="左侧收起"
un-active-text="左侧展开"
:nav-list="navList"
@selected="selected"
/>
<nut-fixed-nav
v-model:visible="visible2"
:position="{ top: '210px' }"
:overlay="false"
:nav-list="navList"
@selected="selected"
/>
<Basic />

<nut-fixed-nav v-model:visible="myActive" :position="{ top: '280px' }" type="left" @selected="selected">
<template #list>
<ul class="nut-fixed-nav__list">
<li class="nut-fixed-nav__list-item">1</li>
<li class="nut-fixed-nav__list-item">2</li>
<li class="nut-fixed-nav__list-item">3</li>
<li class="nut-fixed-nav__list-item">4</li>
<li class="nut-fixed-nav__list-item">5</li>
</ul>
</template>
<template #btn>
<Retweet color="#fff" />
<span class="text">{{ myActive ? '自定义开' : '自定义关' }}</span>
</template>
</nut-fixed-nav>
<Left />

<Overlay />

<Custom />
</Demo>
</template>

<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue';
import { Retweet } from '@nutui/icons-vue-taro';
const visible = ref(false);
const visible1 = ref(false);
const visible2 = ref(false);
const myActive = ref(false);

onMounted(() => {
setTimeout(() => {
visible2.value = true;
}, 1000);
});

const navList = reactive([
{
id: 1,
text: '首页',
icon: 'https://img11.360buyimg.com/imagetools/jfs/t1/117646/2/11112/1297/5ef83e95E81d77f05/daf8e3b1c81e3c98.png'
},
{
id: 2,
text: '分类',
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/119490/8/9568/1798/5ef83e95E968c69a6/dd029326f7d5042e.png'
},
{
id: 3,
text: '购物车',
num: 2,
icon: 'https://img14.360buyimg.com/imagetools/jfs/t1/130725/4/3157/1704/5ef83e95Eb976644f/b36c6cfc1cc1a99d.png'
},
{
id: 4,
text: '我的',
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/147573/29/1603/1721/5ef83e94E1393a678/5ddf1695ec989373.png'
}
]);
const selected = (res: any) => {
console.log(res);
};
import Basic from './basic.vue';
import Left from './left.vue';
import Overlay from './overlay.vue';
import Custom from './custom.vue';
</script>
30 changes: 30 additions & 0 deletions packages/nutui-taro-demo/src/nav/pages/fixednav/left.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<template>
<nut-fixed-nav v-model:visible="visible" type="left" :position="{ top: '140px' }" :nav-list="navList" />
</template>
<script setup lang="ts">
import { ref } from 'vue';
const visible = ref(false);
const navList = ref([
{
id: 1,
text: '首页',
icon: 'https://img11.360buyimg.com/imagetools/jfs/t1/117646/2/11112/1297/5ef83e95E81d77f05/daf8e3b1c81e3c98.png'
},
{
id: 2,
text: '分类',
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/119490/8/9568/1798/5ef83e95E968c69a6/dd029326f7d5042e.png'
},
{
id: 3,
text: '购物车',
num: 2,
icon: 'https://img14.360buyimg.com/imagetools/jfs/t1/130725/4/3157/1704/5ef83e95Eb976644f/b36c6cfc1cc1a99d.png'
},
{
id: 4,
text: '我的',
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/147573/29/1603/1721/5ef83e94E1393a678/5ddf1695ec989373.png'
}
]);
</script>
30 changes: 30 additions & 0 deletions packages/nutui-taro-demo/src/nav/pages/fixednav/overlay.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<template>
<nut-fixed-nav v-model:visible="visible" :overlay="false" :position="{ top: '210px' }" :nav-list="navList" />
</template>
<script setup lang="ts">
import { ref } from 'vue';
const visible = ref(false);
const navList = ref([
{
id: 1,
text: '首页',
icon: 'https://img11.360buyimg.com/imagetools/jfs/t1/117646/2/11112/1297/5ef83e95E81d77f05/daf8e3b1c81e3c98.png'
},
{
id: 2,
text: '分类',
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/119490/8/9568/1798/5ef83e95E968c69a6/dd029326f7d5042e.png'
},
{
id: 3,
text: '购物车',
num: 2,
icon: 'https://img14.360buyimg.com/imagetools/jfs/t1/130725/4/3157/1704/5ef83e95Eb976644f/b36c6cfc1cc1a99d.png'
},
{
id: 4,
text: '我的',
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/147573/29/1603/1721/5ef83e94E1393a678/5ddf1695ec989373.png'
}
]);
</script>
122 changes: 0 additions & 122 deletions src/packages/__VUE/fixednav/demo.vue

This file was deleted.

30 changes: 30 additions & 0 deletions src/packages/__VUE/fixednav/demo/basic.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<template>
<nut-fixed-nav v-model:visible="visible" :position="{ top: '70px' }" :nav-list="navList" />
</template>
<script setup lang="ts">
import { ref } from 'vue';
const visible = ref(false);
const navList = ref([
{
id: 1,
text: '首页',
icon: 'https://img11.360buyimg.com/imagetools/jfs/t1/117646/2/11112/1297/5ef83e95E81d77f05/daf8e3b1c81e3c98.png'
},
{
id: 2,
text: '分类',
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/119490/8/9568/1798/5ef83e95E968c69a6/dd029326f7d5042e.png'
},
{
id: 3,
text: '购物车',
num: 2,
icon: 'https://img14.360buyimg.com/imagetools/jfs/t1/130725/4/3157/1704/5ef83e95Eb976644f/b36c6cfc1cc1a99d.png'
},
{
id: 4,
text: '我的',
icon: 'https://img12.360buyimg.com/imagetools/jfs/t1/147573/29/1603/1721/5ef83e94E1393a678/5ddf1695ec989373.png'
}
]);
</script>
22 changes: 22 additions & 0 deletions src/packages/__VUE/fixednav/demo/custom.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<template>
<nut-fixed-nav v-model:visible="visible" :position="{ top: '280px' }" type="left">
<template #list>
<ul class="nut-fixed-nav__list">
<li class="nut-fixed-nav__list-item">1</li>
<li class="nut-fixed-nav__list-item">2</li>
<li class="nut-fixed-nav__list-item">3</li>
<li class="nut-fixed-nav__list-item">4</li>
<li class="nut-fixed-nav__list-item">5</li>
</ul>
</template>
<template #btn>
<Retweet color="#fff" />
<span class="text">{{ visible ? '自定义开' : '自定义关' }}</span>
</template>
</nut-fixed-nav>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { Retweet } from '@nutui/icons-vue';
const visible = ref(false);
</script>
Loading