47 Star 323 Fork 4

jry/uview-plus

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
navbar.nvue 2.41 KB
一键复制 编辑 原始数据 按行查看 历史
<template>
<view class="u-page">
<!-- 2.0.19支持autoBack,默认为false -->
<up-navbar
title="导航栏"
safeAreaInsetTop
fixed
placeholder
:autoBack="true"
>
</up-navbar>
<view class="u-page__item">
<text class="u-page__item__title">基础功能</text>
<up-navbar
title="个人中心"
:safeAreaInsetTop="false"
:fixed="false"
@rightClick="rightClick"
@leftClick="leftClick"
>
</up-navbar>
</view>
<view class="u-page__item">
<text class="u-page__item__title">自定义文本</text>
<up-navbar
:safeAreaInsetTop="false"
title="个人中心"
:fixed="false"
left-text="返回"
rightIcon="map"
>
</up-navbar>
</view>
<view class="u-page__item">
<text class="u-page__item__title">自定义插槽</text>
<up-navbar
leftText="返回"
:fixed="false"
title="个人中心"
:safeAreaInsetTop="false"
>
<template #left>
<view
class="u-nav-slot"
>
<up-icon
name="arrow-left"
size="19"
></up-icon>
<up-line
direction="column"
:hairline="false"
length="16"
margin="0 8px"
></up-line>
<up-icon
name="home"
size="20"
></up-icon>
</view>
</template>
</up-navbar>
</view>
<up-gap height="50"></up-gap>
</view>
</template>
<script setup>
// 导入必要的函数
import { getCurrentInstance } from 'vue'
// 使用 getCurrentInstance 获取当前实例
const instance = getCurrentInstance()
// 定义方法
const navigateBack = () => {
uni.navigateBack({
delta: 1
})
}
const rightClick = () => {
console.log('rightClick');
}
const leftClick = () => {
console.log('leftClick');
}
</script>
<style lang="scss">
/* #ifndef APP-NVUE */
page {
background-color: $u-bg-color;
}
/* #endif */
.u-page {
padding: 0;
flex: 1;
background-color: $u-bg-color;
&__item {
&__title {
color: $u-tips-color;
background-color: $u-bg-color;
padding: 15px;
font-size: 15px;
&__slot-title {
color: $u-primary;
font-size: 14px;
}
}
}
}
.u-nav-slot {
@include flex;
align-items: center;
justify-content: space-between;
border-width: 0.5px;
border-radius: 100px;
border-color: $u-border-color;
padding: 3px 7px;
opacity: 0.8;
}
</style>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jry/uview-plus.git
git@gitee.com:jry/uview-plus.git
jry
uview-plus
uview-plus
3.x

搜索帮助