首页导航栏自定义
This commit is contained in:
parent
76c96b71d1
commit
d06eb120e3
@ -10,7 +10,8 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/index/index",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "首页"
|
"navigationBarTitleText": "首页",
|
||||||
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -19,6 +20,12 @@
|
|||||||
"navigationBarTitleText": "我的"
|
"navigationBarTitleText": "我的"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/category/category",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "分类"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/test-page/test-page",
|
"path": "pages/test-page/test-page",
|
||||||
"style": {
|
"style": {
|
||||||
@ -41,6 +48,12 @@
|
|||||||
"pagePath": "pages/index/index",
|
"pagePath": "pages/index/index",
|
||||||
"text": "首页"
|
"text": "首页"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"iconPath": "static/icon/category.png",
|
||||||
|
"selectedIconPath": "static/icon/category-select.png",
|
||||||
|
"pagePath": "pages/category/category",
|
||||||
|
"text": "分类"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"iconPath": "static/icon/My.png",
|
"iconPath": "static/icon/My.png",
|
||||||
"selectedIconPath": "static/icon/My-select.png",
|
"selectedIconPath": "static/icon/My-select.png",
|
||||||
|
13
src/pages/category/category.vue
Normal file
13
src/pages/category/category.vue
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<script setup>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
分类页
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
@ -1,4 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
|
<view class="navbar" :style="{ minHeight: navHeight + 'px' }" style="background: #1296db">
|
||||||
|
<view
|
||||||
|
class="topInfo"
|
||||||
|
:style="{
|
||||||
|
paddingTop: statusBarHeight + 'px',
|
||||||
|
paddingRight: capsuleWidth + 'px',
|
||||||
|
}">
|
||||||
|
|
||||||
|
<uni-search-bar v-model="search.keyword" bgColor="#EEEEEE" placeholder="请输入搜索内容" @confirm="searchKeyword" cancelButton="none"></uni-search-bar>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<swiper indicator-dots circular :autoplay="false" class="banner">
|
<swiper indicator-dots circular :autoplay="false" class="banner">
|
||||||
<swiper-item v-for="item in pic.list" :key="item.id">
|
<swiper-item v-for="item in pic.list" :key="item.id">
|
||||||
<image @tap="previewImage(item)" :src="item.url"></image>
|
<image @tap="previewImage(item)" :src="item.url"></image>
|
||||||
@ -22,6 +35,9 @@ let timer = null
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
navHeight: 0,
|
||||||
|
statusBarHeight: 0,
|
||||||
|
capsuleWidth: 0,
|
||||||
now: moment().format('YYYY-MM-DD HH:mm:ss'),
|
now: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
title: 'Hello',
|
title: 'Hello',
|
||||||
pic: {
|
pic: {
|
||||||
@ -35,10 +51,19 @@ export default {
|
|||||||
url: "https://www.httpbin.org/image/jpeg",
|
url: "https://www.httpbin.org/image/jpeg",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
search: {
|
||||||
|
keyword: ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
let capsule = uni.getMenuButtonBoundingClientRect(); // 小程序右上角胶囊信息
|
||||||
|
let system = uni.getSystemInfoSync(); // 获取设备信息
|
||||||
|
this.navHeight = system.statusBarHeight + capsule.height; // 导航栏的高度
|
||||||
|
this.statusBarHeight = system.statusBarHeight // 与顶部的距离
|
||||||
|
this.capsuleWidth = capsule.width; // 胶囊按钮与右侧的距离
|
||||||
|
|
||||||
if(timer){
|
if(timer){
|
||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
}
|
}
|
||||||
@ -55,6 +80,15 @@ export default {
|
|||||||
indicator: 'default',
|
indicator: 'default',
|
||||||
loop: true
|
loop: true
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
searchKeyword() {
|
||||||
|
console.log(this.search.keyword)
|
||||||
|
|
||||||
|
uni.showModal({
|
||||||
|
title: '发起搜索',
|
||||||
|
content: `搜索关键字:${this.search.keyword}`,
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,10 @@ function getLocation(){
|
|||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: "wgs84",
|
type: "wgs84",
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
console.log(`当前位置: ${res.latitude}, ${res.longitude}`)
|
console.log(`当前位置: ${res.longitude},${res.latitude}`)
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '获取位置成功',
|
title: '获取位置成功',
|
||||||
content: `当前位置: ${res.latitude}, ${res.longitude}`,
|
content: `当前位置: ${res.longitude},${res.latitude}`,
|
||||||
showCancel: false
|
showCancel: false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
BIN
src/static/icon/category-select.png
Normal file
BIN
src/static/icon/category-select.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 483 B |
BIN
src/static/icon/category.png
Normal file
BIN
src/static/icon/category.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 458 B |
Loading…
Reference in New Issue
Block a user