Skip to content

Commit

Permalink
feat: sidenavbar, pagination, tabbar , badge, avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
yang1206 committed Jun 18, 2023
1 parent 3ddf33e commit 312acf8
Show file tree
Hide file tree
Showing 53 changed files with 3,043 additions and 237 deletions.
36 changes: 18 additions & 18 deletions example/package.json
Expand Up @@ -39,20 +39,20 @@
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"@dcloudio/uni-app": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-app-plus": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-components": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-h5": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-mp-alipay": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-mp-baidu": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-mp-jd": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-mp-lark": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-mp-qq": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-mp-toutiao": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-app": "3.0.0-3080420230531001",
"@dcloudio/uni-app-plus": "3.0.0-3080420230531001",
"@dcloudio/uni-components": "3.0.0-3080420230531001",
"@dcloudio/uni-h5": "3.0.0-3080420230531001",
"@dcloudio/uni-mp-alipay": "3.0.0-3080420230531001",
"@dcloudio/uni-mp-baidu": "3.0.0-3080420230531001",
"@dcloudio/uni-mp-jd": "3.0.0-3080420230531001",
"@dcloudio/uni-mp-kuaishou": "3.0.0-3080420230531001",
"@dcloudio/uni-mp-lark": "3.0.0-3080420230531001",
"@dcloudio/uni-mp-qq": "3.0.0-3080420230531001",
"@dcloudio/uni-mp-toutiao": "3.0.0-3080420230531001",
"@dcloudio/uni-mp-weixin": "3.0.0-3080420230531001",
"@dcloudio/uni-mp-xhs": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-quickapp-webview": "3.0.0-3080420230531001",
"@uni-helper/uni-env": "^0.0.3",
"pinia": "^2.0.36",
"uniapp-nutui": "workspace:^",
Expand All @@ -61,10 +61,10 @@
},
"devDependencies": {
"@dcloudio/types": "^3.3.3",
"@dcloudio/uni-automator": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-stacktracey": "3.0.0-alpha-3080520230616001",
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-3080520230616001",
"@dcloudio/uni-automator": "3.0.0-3080420230531001",
"@dcloudio/uni-cli-shared": "3.0.0-3080420230531001",
"@dcloudio/uni-stacktracey": "3.0.0-3080420230531001",
"@dcloudio/vite-plugin-uni": "3.0.0-3080420230531001",
"@iconify-json/tabler": "^1.1.79",
"@uni-helper/uni-app-types": "^0.5.8",
"@uni-helper/vite-plugin-uni-components": "^0.0.6",
Expand All @@ -79,7 +79,7 @@
"unocss": "^0.53.1",
"unocss-applet": "^0.5.3",
"unplugin-auto-import": "^0.16.4",
"vite": "4.3.9",
"vite": "4.2.2",
"vue-tsc": "^1.6.5"
}
}
10 changes: 10 additions & 0 deletions example/src/components.d.ts
Expand Up @@ -11,7 +11,10 @@ declare module '@vue/runtime-core' {
export interface GlobalComponents {
DemoHeader: typeof import('./components/DemoHeader.vue')['default']
NutActionSheet: typeof import('uniapp-nutui/components/actionsheet/actionsheet.vue')['default']
NutAvatar: typeof import('uniapp-nutui/components/avatar/avatar.vue')['default']
NutAvatarGroup: typeof import('uniapp-nutui/components/avatargroup/avatargroup.vue')['default']
NutBacktop: typeof import('uniapp-nutui/components/backtop/backtop.vue')['default']
NutBadge: typeof import('uniapp-nutui/components/badge/badge.vue')['default']
NutButton: typeof import('uniapp-nutui/components/button/button.vue')['default']
NutCell: typeof import('uniapp-nutui/components/cell/cell.vue')['default']
NutCellGroup: typeof import('uniapp-nutui/components/cellgroup/cellgroup.vue')['default']
Expand All @@ -30,13 +33,20 @@ declare module '@vue/runtime-core' {
NutInfiniteloading: typeof import('uniapp-nutui/components/infiniteloading/infiniteloading.vue')['default']
NutMenu: typeof import('uniapp-nutui/components/menu/menu.vue')['default']
NutMenuItem: typeof import('uniapp-nutui/components/menuitem/menuitem.vue')['default']
NutNavbar: typeof import('uniapp-nutui/components/navbar/navbar.vue')['default']
NutNotify: typeof import('uniapp-nutui/components/notify/notify.vue')['default']
NutOverlay: typeof import('uniapp-nutui/components/overlay/overlay.vue')['default']
NutPagination: typeof import('uniapp-nutui/components/pagination/pagination.vue')['default']
NutPopup: typeof import('uniapp-nutui/components/popup/popup.vue')['default']
NutRow: typeof import('uniapp-nutui/components/row/row.vue')['default']
NutSideNavbar: typeof import('uniapp-nutui/components/sidenavbar/sidenavbar.vue')['default']
NutSideNavbarItem: typeof import('uniapp-nutui/components/sidenavbaritem/sidenavbaritem.vue')['default']
NutSticky: typeof import('uniapp-nutui/components/sticky/sticky.vue')['default']
NutSubSideNavbar: typeof import('uniapp-nutui/components/subsidenavbar/subsidenavbar.vue')['default']
NutSwipe: typeof import('uniapp-nutui/components/swipe/swipe.vue')['default']
NutSwitch: typeof import('uniapp-nutui/components/switch/switch.vue')['default']
NutTabbar: typeof import('uniapp-nutui/components/tabbar/tabbar.vue')['default']
NutTabbarItem: typeof import('uniapp-nutui/components/tabbaritem/tabbaritem.vue')['default']
NutToast: typeof import('uniapp-nutui/components/toast/toast.vue')['default']
ThemeSwitch: typeof import('./components/ThemeSwitch.vue')['default']
}
Expand Down
175 changes: 175 additions & 0 deletions example/src/demo/exhibition/pages/avatar/index.vue
@@ -0,0 +1,175 @@
<script lang="ts">
export default {
props: {},
setup() {
const handleClick = () => {
console.log('触发点击头像')
}
return { handleClick }
},
}
</script>

<template>
<div class="demo full avatar-demo">
<h2 class="title">
支持三种尺寸:small、normal、large
</h2>
<nut-cell>
<nut-avatar size="large">
<image
class="w-60px h-60px"
mode="scaleToFill"
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
/>
</nut-avatar>
<nut-avatar size="normal">
<img
class="w-40px h-40px"
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
>
</nut-avatar>
<nut-avatar size="small">
<img
class="w-30px h-30px"
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
>
</nut-avatar>
</nut-cell>
<h2 class="title">
支持两种形状:square、round
</h2>
<nut-cell>
<nut-avatar shape="square">
<nut-icon name="my" />
</nut-avatar>
<nut-avatar shape="round">
<nut-icon name="my" />
</nut-avatar>
</nut-cell>
<h2 class="title">
支持三种类型:图片、Icon 以及字符
</h2>
<nut-cell>
<nut-avatar>
<img
class="w-30px h-30px"
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
>
</nut-avatar>
<nut-avatar><nut-icon name="my" /></nut-avatar>
<nut-avatar>王</nut-avatar>
</nut-cell>
<h2 class="title">
Icon 和字符型可以自定义颜色及背景色
</h2>
<nut-cell>
<nut-avatar class="demo-avatar" bg-color="#FA2C19">
<nut-icon name="my" color="#fff" />
</nut-avatar>
<nut-avatar color="rgb(245, 106, 0)" bg-color="rgb(253, 227, 207)">
小明
</nut-avatar>
</nut-cell>
<h2 class="title">
带徽标的头像
</h2>
<nut-cell>
<nut-badge value="8">
<nut-avatar shape="square">
<nut-icon name="my" />
</nut-avatar>
</nut-badge>
<nut-badge dot>
<nut-avatar shape="square">
<nut-icon name="my" />
</nut-avatar>
</nut-badge>
</nut-cell>
<h2 class="title">
头像组合展现
</h2>
<nut-cell>
<nut-avatar-group span="-4">
<nut-avatar>
<img
class="w-30px h-30px"
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
>
</nut-avatar>
<nut-avatar><nut-icon name="my" /></nut-avatar>
<nut-avatar color="rgb(245, 106, 0)" bg-color="rgb(253, 227, 207)">
小明
</nut-avatar>
</nut-avatar-group>
</nut-cell>

<nut-cell>
<nut-avatar-group max-count="3" max-color="#fff" max-bg-color="#498ff2">
<nut-avatar>
<img
class="w-30px h-30px"
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
>
</nut-avatar>
<nut-avatar><nut-icon name="my" /></nut-avatar>
<nut-avatar color="rgb(245, 106, 0)" bg-color="rgb(253, 227, 207)">
小明
</nut-avatar>
<nut-avatar><nut-icon name="my" /></nut-avatar>
</nut-avatar-group>
</nut-cell>
<h2 class="title">
组合头像可控制层级方向
</h2>
<nut-cell>
<nut-avatar-group max-count="3" z-index="right" max-content="...">
<nut-avatar>
<img
class="w-30px h-30px"
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
>
</nut-avatar>
<nut-avatar><nut-icon name="my" /></nut-avatar>
<nut-avatar color="rgb(245, 106, 0)" bg-color="rgb(253, 227, 207)">
小明
</nut-avatar>
<nut-avatar><nut-icon name="my" /></nut-avatar>
</nut-avatar-group>
</nut-cell>

<h2 class="title">
点击头像触发事件
</h2>
<nut-cell>
<nut-avatar @click="handleClick">
<nut-icon name="my" />
</nut-avatar>
</nut-cell>
</div>
</template>

<style lang="scss">
.avatar-demo {
.nut-cell {
align-items: flex-end;
border-radius: 0;
& > view {
margin-right: 30px;
}
}
.demo-avatar {
color: #fff;
}
}
</style>

<route lang="json">
{
"style": {
"navigationBarTitleText": "Avatar"
}
}
</route>
125 changes: 125 additions & 0 deletions example/src/demo/exhibition/pages/badge/index.vue
@@ -0,0 +1,125 @@
<script lang="ts" setup>
</script>

<template>
<view class="demo badge-demo">
<h2 class="title">
基础用法
</h2>
<nut-row>
<nut-badge :value="8">
<nut-avatar shape="square" />
</nut-badge>
<nut-badge :value="76">
<nut-avatar shape="square" />
</nut-badge>
<nut-badge value="NEW">
<nut-avatar shape="square" />
</nut-badge>
<nut-badge value="NEW" bubble>
<nut-avatar shape="square" />
</nut-badge>
<nut-badge dot>
<nut-avatar shape="square" />
</nut-badge>
</nut-row>
<h2 class="title">
最大值
</h2>
<nut-row>
<nut-badge :value="200" :max="9">
<nut-avatar shape="square" />
</nut-badge>
<nut-badge :value="200" :max="20">
<nut-avatar shape="square" />
</nut-badge>
<nut-badge :value="200" :max="99">
<nut-avatar shape="square" />
</nut-badge>
</nut-row>

<h2 class="title">
自定义颜色
</h2>
<nut-row>
<nut-badge :value="8" color="linear-gradient(315deg, rgba(73,143,242,1) 0%,rgba(73,101,242,1) 100%)">
<nut-avatar shape="square" />
</nut-badge>
<nut-badge :value="76" color="linear-gradient(315deg, rgba(73,143,242,1) 0%,rgba(73,101,242,1) 100%)">
<nut-avatar shape="square" />
</nut-badge>
<nut-badge value="NEW" color="linear-gradient(315deg, rgba(73,143,242,1) 0%,rgba(73,101,242,1) 100%)">
<nut-avatar shape="square" />
</nut-badge>
<nut-badge dot color="linear-gradient(315deg, rgba(73,143,242,1) 0%,rgba(73,101,242,1) 100%)">
<nut-avatar shape="square" />
</nut-badge>
</nut-row>

<h2 class="title">
自定义徽标内容
</h2>
<nut-row>
<nut-badge>
<template #icon>
<nut-icon name="check" color="#1919" size="12px" />
</template>
<nut-avatar shape="square" />
</nut-badge>
<nut-badge>
<template #icon>
<nut-icon name="link" color="#ffffff" size="12px" />
</template>
<nut-avatar shape="square" />
</nut-badge>
<nut-badge>
<template #icon>
<nut-icon name="download" color="#ffffff" size="12px" />
</template>
<nut-avatar shape="square" />
</nut-badge>
</nut-row>

<h2 class="title">
自定义位置
</h2>
<nut-row>
<nut-badge :value="8" top="5" right="5">
<nut-avatar shape="square" />
</nut-badge>
<nut-badge :value="76" top="10" right="10">
<nut-avatar shape="square" />
</nut-badge>
<nut-badge value="NEW">
<nut-avatar shape="square" />
</nut-badge>
</nut-row>

<h2 class="title">
独立展示
</h2>
<nut-row>
<nut-badge :value="8" />
<nut-badge :value="76" />
<nut-badge value="NEW" />
</nut-row>
</view>
</template>

<style lang="scss">
.badge-demo {
.nut-badge {
margin-top: 20px;
margin-right: 40px;
}
}
</style>

<route lang="json">
{
"style": {
"navigationBarTitleText": "Badge"
}
}
</route>

0 comments on commit 312acf8

Please sign in to comment.