| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 | <template>	<view class="container">		<uni-nav-bar :fixed="true" color="#ffffff" background-color="#007AFF" :status-bar="true" left-icon="arrowleft"			left-text="返回" title="uni-nav-bar 标题" @clickLeft="back" />		<uni-card is-full :isShadow="false">			<text				class="uni-h6">本导航栏为自定义组件,并非原生导航栏。除非原生导航栏无法满足需求,否则不推荐使用自定义导航栏组件。具体参考https://ask.dcloud.net.cn/article/34921</text>		</uni-card>		<uni-section title="基本用法" type="line" style="margin-bottom: 3px;">			<uni-nav-bar left-icon="left" title="标题" @clickLeft="back" />		</uni-section>		<uni-section title="左右显示文字" type="line" style="margin-bottom: 3px;">			<uni-nav-bar left-icon="left" right-text="菜单" left-text="返回" title="标题" @clickLeft="back" />		</uni-section>		<uni-section title="插入slot" type="line" style="margin-bottom: 3px;">			<uni-nav-bar :fixed="false" color="#333333" background-color="#FFFFFF" right-icon="scan" @clickLeft="showCity"				@clickRight="scan">				<block slot="left">					<view class="city">						<view>							<text class="uni-nav-bar-text">{{ city }}</text>						</view>						<uni-icons type="arrowdown" color="#333333" size="22" />					</view>				</block>				<view class="input-view">					<uni-icons class="input-uni-icon" type="search" size="18" color="#999" />					<input confirm-type="search" class="nav-bar-input" type="text" placeholder="输入搜索关键词"						@confirm="confirm" />				</view>			</uni-nav-bar>		</uni-section>			</view></template><script>	export default {		components: {},		data() {			return {				city: '北京'			}		},		methods: {			back() {				uni.navigateBack({					delta: 1				})			},			showMenu() {				uni.showToast({					title: '菜单'				})			},			clickLeft() {				uni.showToast({					title: '左侧按钮'				})			},			search() {				uni.showToast({					title: '搜索'				})			},			showCity() {				uni.showToast({					title: '选择城市'				})			},			scan() {				uni.showToast({					title: '扫码'				})			},			confirm() {				uni.showToast({					title: '搜索'				})			}		},		onPullDownRefresh() {			console.log('onPullDownRefresh')			setTimeout(function() {				uni.stopPullDownRefresh()				console.log('stopPullDownRefresh')			}, 1000)		}	}</script><style lang="scss" scoped>	$nav-height: 30px;	/* #ifndef APP-NVUE */	page {		height: 120%;	}	/* #endif */	.uni-nav-bar-text {		font-size: 12px;	}	.city {		/* #ifndef APP-PLUS-NVUE */		display: flex;		/* #endif */		flex-direction: row;		align-items: center;		justify-content: flex-start;		// width: 160rpx;		margin-left: 4px;	}	.input-view {		/* #ifndef APP-PLUS-NVUE */		display: flex;		/* #endif */		flex-direction: row;		// width: 500rpx;		flex: 1;		background-color: #f8f8f8;		height: $nav-height;		border-radius: 15px;		padding: 0 15px;		flex-wrap: nowrap;		margin: 7px 0;		line-height: $nav-height;	}	.input-uni-icon {		line-height: $nav-height;	}	.nav-bar-input {		height: $nav-height;		line-height: $nav-height;		/* #ifdef APP-PLUS-NVUE */		width: 370rpx;		/* #endif */		padding: 0 5px;		font-size: 14px;		background-color: #f8f8f8;	}	.example-body {		/* #ifndef APP-NVUE */		display: block;		/* #endif */		padding: 0;	}</style>
 |