Files
hzdyjs/mobile/src/components/NavBar.vue
T
zlwu 28232d5d46 feat: 移动端开发规范重大更新
- 🔥 完全重写 .cursor/cursorrules-mobile.md (940行)
  * 基于实际mobile工程Vue 3.4.21+uniapp+uview-plus架构
  * 移除所有JeeSite相关内容,精准匹配实际项目
  * 新增11个完整章节:技术栈、项目结构、页面开发、组件规范等

- 📚 创建完整规范文档 docs/开发文档/移动端开发规范总结.md (800+行)
  * 涵盖从项目架构到部署的全流程指导
  * 提供可直接使用的页面和组件模板
  * 包含现代CSS变量设计系统和用户体验优化

- 🔄 同步更新主配置文件 .cursorrules
  * 更新移动端技术栈描述
  * 调整为Vue 3.4.21+uniapp+uview-plus 3.4.45架构

- 📝 完善变更记录
  * 详细记录规范更新背景和技术价值
  * 为后续维护提供完整历史记录

核心价值:解决规范与实际项目不匹配问题,为Cursor AI提供准确的移动端开发上下文,确保生成代码完全符合实际项目架构。
2025-07-04 15:51:33 +08:00

177 lines
4.0 KiB
Vue

<template>
<view class="navbar" :style="{ paddingTop: statusBarHeight + 'px' }">
<view class="navbar-content">
<text class="navbar-title">{{ title }}</text>
<view class="navbar-actions">
<slot name="actions">
<view
v-if="showRefresh"
class="btn-icon refresh-btn touchable"
@click="handleRefresh"
:aria-label="refreshLabel"
>
<text class="icon">🔄</text>
</view>
<view
v-if="showSearch"
class="btn-icon touchable"
@click="handleSearch"
:aria-label="searchLabel"
>
<text class="icon">🔍</text>
</view>
<view
v-if="showSettings"
class="btn-icon touchable"
@click="handleSettings"
:aria-label="settingsLabel"
>
<text class="icon">⚙️</text>
</view>
</slot>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'NavBar',
props: {
title: {
type: String,
default: '智慧校园',
},
showRefresh: {
type: Boolean,
default: false,
},
showSearch: {
type: Boolean,
default: false,
},
showSettings: {
type: Boolean,
default: false,
},
refreshLabel: {
type: String,
default: '刷新',
},
searchLabel: {
type: String,
default: '搜索',
},
settingsLabel: {
type: String,
default: '设置',
},
},
data() {
return {
statusBarHeight: 20,
};
},
mounted() {
// 获取状态栏高度
const systemInfo = uni.getSystemInfoSync();
this.statusBarHeight = systemInfo.statusBarHeight || 20;
},
methods: {
handleRefresh() {
this.$emit('refresh');
// 触觉反馈
uni.vibrateShort();
},
handleSearch() {
this.$emit('search');
uni.vibrateShort();
},
handleSettings() {
this.$emit('settings');
uni.vibrateShort();
},
},
};
</script>
<style lang="scss" scoped>
.navbar {
background: linear-gradient(135deg, $uni-color-primary, $uni-color-primary-dark);
color: $uni-text-color-inverse;
padding-bottom: 16px;
position: sticky;
top: 0;
z-index: 100;
box-shadow: $uni-shadow;
}
.navbar-content {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 $uni-spacing-row-lg;
min-height: 44px;
}
.navbar-title {
font-size: $uni-font-size-xl;
font-weight: 600;
color: $uni-text-color-inverse;
}
.navbar-actions {
display: flex;
gap: $uni-spacing-row-base;
}
.btn-icon {
background: rgba(255, 255, 255, 0.2);
border-radius: $uni-border-radius-circle;
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
transition: $uni-transition;
&:hover {
background: rgba(255, 255, 255, 0.3);
transform: scale(1.1);
}
.icon {
font-size: 18px;
color: $uni-text-color-inverse;
}
}
/* 动画效果 */
.refresh-btn {
animation: none;
&:active {
animation: spin 0.6s ease-in-out;
}
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* 无障碍支持 */
.btn-icon[aria-label] {
position: relative;
&:focus {
outline: 2px solid rgba(255, 255, 255, 0.5);
outline-offset: 2px;
}
}
</style>