Blame view

pages/extUI/goods-nav/goods-nav.nvue 2.46 KB
4b045f7c   刘淇   江阴初始化项目
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
  <template>
  	<view class="uni-container">
  		<uni-card is-full>
  			<text class="uni-h6"> uni-goods-nav 组件主要用于电商类应用底部导航,可自定义加入购物车,购买等操作</text>
  		</uni-card>
  		<uni-section title="基础用法" type="line">
  			<uni-goods-nav @click="onClick" />
  		</uni-section>
  		<uni-section title="自定义用法" type="line">
  			<uni-goods-nav :fill="true" :options="options" :button-group="customButtonGroup" @click="onClick"
  				@buttonClick="buttonClick" />
  			<uni-goods-nav :fill="true" :options="options" :button-group="customButtonGroup1" @click="onClick"
  				@buttonClick="buttonClick" style="margin-top: 20px;" />
  		</uni-section>
  		<view class="goods-carts">
  			<uni-goods-nav :options="options" :fill="true" :button-group="buttonGroup" @click="onClick"
  				@buttonClick="buttonClick" />
  		</view>
  
  	</view>
  </template>
  
  <script>
  	export default {
  		components: {},
  		data() {
  			return {
  				options: [{
  					icon: 'chat',
  					text: '客服'
  				}, {
  					icon: 'shop',
  					text: '店铺',
  					info: 2,
  					infoBackgroundColor: '#007aff',
  					infoColor: "#f5f5f5"
  				}, {
  					icon: 'cart',
  					text: '购物车',
  					info: 2
  				}],
  				buttonGroup: [{
  						text: '加入购物车',
  						backgroundColor: 'linear-gradient(90deg, #FFCD1E, #FF8A18)',
  						color: '#fff'
  					},
  					{
  						text: '立即购买',
  						backgroundColor: 'linear-gradient(90deg, #FE6035, #EF1224)',
  						color: '#fff'
  					}
  				],
  				customButtonGroup: [{
  						text: '加入购物车',
  						backgroundColor: 'linear-gradient(90deg, #1E83FF, #0053B8)',
  						color: '#fff'
  					},
  					{
  						text: '立即购买',
  						backgroundColor: 'linear-gradient(90deg, #60F3FF, #088FEB)',
  						color: '#fff'
  					}
  				],
  				customButtonGroup1: [{
  					text: '立即购买',
  					backgroundColor: 'linear-gradient(90deg, #FE6035, #EF1224)',
  					color: '#fff'
  				}]
  			}
  		},
  		onLoad() {},
  		methods: {
  			onClick(e) {
  				uni.showToast({
  					title: `点击${e.content.text}`,
  					icon: 'none'
  				})
  			},
  			buttonClick(e) {
  				console.log(e)
  				this.options[2].info++
  			}
  		}
  	}
  </script>
  
  <style lang="scss">
  	.example-body {
  		padding: 0;
  		/* #ifndef APP-NVUE */
  		display: block;
  		/* #endif */
  	}
  
  	.goods-carts {
  		/* #ifndef APP-NVUE */
  		display: flex;
  		/* #endif */
  		flex-direction: column;
  		position: fixed;
  		left: 0;
  		right: 0;
  		/* #ifdef H5 */
  		left: var(--window-left);
  		right: var(--window-right);
  		/* #endif */
  		bottom: 0;
  	}
  </style>