6 changed files with 122 additions and 43 deletions
@ -0,0 +1,3 @@ |
|||||
|
.cc-active { |
||||
|
transform: translate3d(1rpx, 1rpx, 0); |
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
<template> |
||||
|
<view class="cu-bar tabbar bg-white"> |
||||
|
<view |
||||
|
:class="[index === 0 ? 'text-blue': 'text-gray']" |
||||
|
@tap="handleClickButton(0)" |
||||
|
class="action" |
||||
|
hover-class="cc-active" |
||||
|
> |
||||
|
<view class="cuIcon-home"></view>首页 |
||||
|
</view> |
||||
|
<view @tap="handleClickButton(1)" class="action text-gray add-action"> |
||||
|
<button class="cu-btn cuIcon-scan bg-blue shadow"></button> |
||||
|
扫一扫 |
||||
|
</view> |
||||
|
<view |
||||
|
:class="[index === 2 ? 'text-blue': 'text-gray']" |
||||
|
@tap="handleClickButton(2)" |
||||
|
class="action" |
||||
|
hover-class="cc-active" |
||||
|
> |
||||
|
<view class="cuIcon-my"> |
||||
|
<!-- <view class="cu-tag badge"></view> --> |
||||
|
</view>我的 |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
index: 0, |
||||
|
}; |
||||
|
}, |
||||
|
methods: { |
||||
|
handleClickButton(i) { |
||||
|
this.index = i; |
||||
|
this.$emit('change', i); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
@ -0,0 +1,9 @@ |
|||||
|
<template> |
||||
|
<div>home</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
name: 'Home', |
||||
|
}; |
||||
|
</script> |
@ -0,0 +1,9 @@ |
|||||
|
<template> |
||||
|
<div>user</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
name: 'Mine', |
||||
|
}; |
||||
|
</script> |
@ -1,52 +1,67 @@ |
|||||
<template> |
<template> |
||||
<view class="content"> |
<view class="container"> |
||||
<image class="logo" src="/static/logo.png"></image> |
<view class="content"> |
||||
<view class="text-area"> |
<home v-if="navIndex === 0" /> |
||||
<text class="title">{{title}}</text> |
<mine v-else /> |
||||
</view> |
</view> |
||||
</view> |
<nav-bottom @change="onNavChange" class="nav-bottom"></nav-bottom> |
||||
|
</view> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
export default { |
import Home from './components/home.vue'; |
||||
data() { |
import Mine from './components/mine.vue'; |
||||
return { |
|
||||
title: 'Hello' |
|
||||
} |
|
||||
}, |
|
||||
onLoad() { |
|
||||
|
|
||||
}, |
export default { |
||||
methods: { |
components: { Home, Mine }, |
||||
|
data() { |
||||
|
return { |
||||
|
navIndex: 0, |
||||
|
}; |
||||
|
}, |
||||
|
onLoad() {}, |
||||
|
methods: { |
||||
|
/** |
||||
|
* 监听nav-bottom的点击事件 |
||||
|
* @param {number} index nav-bottom按钮的索引值 |
||||
|
*/ |
||||
|
onNavChange(index) { |
||||
|
this.navIndex = index; |
||||
|
switch (index) { |
||||
|
// 扫一扫 |
||||
|
case 1: |
||||
|
this.handleScan(); |
||||
|
break; |
||||
|
// 我的 |
||||
|
case 2: |
||||
|
break; |
||||
|
// 首页 |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
} |
// 扫一扫 |
||||
} |
handleScan() { |
||||
|
console.log('扫一扫'); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
</script> |
</script> |
||||
|
|
||||
<style> |
<style scoped lang="scss"> |
||||
.content { |
.container { |
||||
display: flex; |
display: flex; |
||||
flex-direction: column; |
flex-direction: column; |
||||
align-items: center; |
align-items: center; |
||||
justify-content: center; |
width: 100%; |
||||
} |
height: 100vh; |
||||
|
|
||||
.logo { |
.content { |
||||
height: 200rpx; |
flex: 1; |
||||
width: 200rpx; |
} |
||||
margin-top: 200rpx; |
.nav-bottom { |
||||
margin-left: auto; |
width: 100%; |
||||
margin-right: auto; |
} |
||||
margin-bottom: 50rpx; |
} |
||||
} |
|
||||
|
|
||||
.text-area { |
|
||||
display: flex; |
|
||||
justify-content: center; |
|
||||
} |
|
||||
|
|
||||
.title { |
|
||||
font-size: 36rpx; |
|
||||
color: #8f8f94; |
|
||||
} |
|
||||
</style> |
</style> |
||||
|
Loading…
Reference in new issue