navigation.vue 1.51 KB
Newer Older
王建威's avatar
王建威 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
<template>
	<view>
		<view class="navigation" :style="[{'height': style_setting.height*2+'rpx', 'line-height': style_setting.height*2+'rpx'}, style_setting.bg_show ? {'background-image': 'url('+style_setting.bg_url+')'} : {'background-color': style_setting.bg_color}]">
			<text class="navigation_text" v-for="(item, key) in list" :key="key" v-if="item.title_show" :style="[{'color': item.title_color}, item.title_bg_show ? {'background-image': 'url('+item.title_bg_url+')'} : '']">
			<i v-if="style_setting.title_icon_show" class="navigation_icon" :style="{'background-image': 'url('+item.title_icon_url+')'}"></i>
			<text>{{item.title}}</text>
			</text>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			wrapper_props: {
				type: Object
			}
		},
		data() {
			return {
				style_setting: this.wrapper_props.style_setting,
				list: this.wrapper_props.list
			}
		}
	}
</script>

<style lang="less" scoped>
	.navigation {
		white-space: nowrap;
		overflow: scroll;
		background-repeat: no-repeat;
		background-size: 100% 100%;
		.navigation_text {
			background-size: 100% 100%;
			background-repeat: no-repeat;
			width: 25%;
			text-align: center;
			display: inline-block;
			font-size: 32rpx;
			text {
				vertical-align: middle;
			}
			.navigation_icon {
				display: inline-block;
				width: 32rpx;
				height: 32rpx;
				background-size: 100% 100%;
				background-repeat: no-repeat;
				vertical-align: middle;
				margin-right: 8rpx;
			}
		}
	}
	.navigation::-webkit-scrollbar {
		display: none;
	}
</style>