|
4 | 4 | <view class="u-demo-title">演示效果</view>
|
5 | 5 | <view class="u-demo-area">
|
6 | 6 | <u-cell-group title="读万卷书">
|
7 |
| - <u-cell-item center :is-link="true" :label="label" value="铁马冰河入梦来" i |
8 |
| - ndex="index" @click="click" :hover-class="hoverClass" |
9 |
| - :arrow="arrow" :title="title" |
10 |
| - :icon="icon" |
11 |
| - > |
| 7 | + <u-cell-item center :is-link="true" :label="label" value="铁马冰河入梦来" i ndex="index" @click="click" :hover-class="hoverClass" |
| 8 | + :arrow="arrow" :title="title" :icon="icon"> |
12 | 9 | <u-badge :absolute="false" v-if="rightSlot == 'badge'" count="105" slot="right-icon"></u-badge>
|
13 | 10 | <u-switch v-if="rightSlot == 'switch'" slot="right-icon" v-model="checked"></u-switch>
|
14 | 11 | </u-cell-item>
|
|
28 | 25 | <view class="u-item-title">更换图标</view>
|
29 | 26 | <u-subsection vibrateShort :list="['是', '否']" @change="iconChange"></u-subsection>
|
30 | 27 | </view>
|
| 28 | + <!-- QQ小程序无法动态切换slot --> |
| 29 | + <!-- #ifndef MP-QQ --> |
31 | 30 | <view class="u-config-item">
|
32 | 31 | <view class="u-item-title">自定义右侧内容</view>
|
33 | 32 | <u-subsection vibrateShort :list="['文字', 'Switch组件', 'Badge组件']" @change="rightSlotChange"></u-subsection>
|
34 | 33 | </view>
|
| 34 | + <!-- #endif --> |
35 | 35 | <view class="u-config-item">
|
36 | 36 | <view class="u-item-title">描述信息</view>
|
37 | 37 | <u-subsection vibrateShort current="1" :list="['是', '否']" @change="lableChange"></u-subsection>
|
|
49 | 49 | </template>
|
50 | 50 |
|
51 | 51 | <script>
|
52 |
| -export default { |
53 |
| - data() { |
54 |
| - return { |
55 |
| - icon: 'setting', |
56 |
| - arrow: true, |
57 |
| - label: '', |
58 |
| - title: '青山一道同云雨', |
59 |
| - rightSlot: true, |
60 |
| - checked: false, |
61 |
| - } |
62 |
| - }, |
63 |
| - computed: { |
64 |
| - hoverClass() { |
65 |
| - // 如果右侧是switch步进器组件的话,去掉cell的点击反馈,因为这个时候点击的反馈应该在switch上 |
66 |
| - return this.rightSlot == 'switch' ? 'none' : 'u-cell-hover'; |
67 |
| - } |
68 |
| - }, |
69 |
| - methods: { |
70 |
| - iconChange(index) { |
71 |
| - this.icon = index == 0 ? 'setting' : 'file-text' |
72 |
| - }, |
73 |
| - arrowChange(index) { |
74 |
| - this.arrow = index == 0 ? true : false |
75 |
| - }, |
76 |
| - lableChange(index) { |
77 |
| - this.label = index == 0 ? '岂曰无衣,与子同裳' : '' |
78 |
| - }, |
79 |
| - titleChange(index) { |
80 |
| - this.title = index == 0 ? '青山一道同云雨' : '明月何曾是两乡' |
| 52 | + export default { |
| 53 | + data() { |
| 54 | + return { |
| 55 | + icon: 'setting', |
| 56 | + arrow: true, |
| 57 | + label: '', |
| 58 | + title: '青山一道同云雨', |
| 59 | + rightSlot: true, |
| 60 | + checked: false, |
| 61 | + } |
81 | 62 | },
|
82 |
| - rightSlotChange(index) { |
83 |
| - this.rightSlot = index == 0 ? 'text' : index == 1 ? 'switch' : 'badge' |
84 |
| - if(index == 0) this.arrow = true; |
85 |
| - else this.arrow = false; |
| 63 | + computed: { |
| 64 | + hoverClass() { |
| 65 | + // 如果右侧是switch步进器组件的话,去掉cell的点击反馈,因为这个时候点击的反馈应该在switch上 |
| 66 | + return this.rightSlot == 'switch' ? 'none' : 'u-cell-hover'; |
| 67 | + } |
86 | 68 | },
|
87 |
| - click(index) { |
88 |
| - // console.log(index); |
| 69 | + methods: { |
| 70 | + iconChange(index) { |
| 71 | + this.icon = index == 0 ? 'setting' : 'file-text' |
| 72 | + }, |
| 73 | + arrowChange(index) { |
| 74 | + this.arrow = index == 0 ? true : false |
| 75 | + }, |
| 76 | + lableChange(index) { |
| 77 | + this.label = index == 0 ? '岂曰无衣,与子同裳' : '' |
| 78 | + }, |
| 79 | + titleChange(index) { |
| 80 | + this.title = index == 0 ? '青山一道同云雨' : '明月何曾是两乡' |
| 81 | + }, |
| 82 | + rightSlotChange(index) { |
| 83 | + this.rightSlot = index == 0 ? 'text' : index == 1 ? 'switch' : 'badge' |
| 84 | + if (index == 0) this.arrow = true; |
| 85 | + else this.arrow = false; |
| 86 | + }, |
| 87 | + click(index) { |
| 88 | + // console.log(index); |
| 89 | + } |
89 | 90 | }
|
90 |
| - } |
91 |
| -}; |
| 91 | + }; |
92 | 92 | </script>
|
93 | 93 |
|
94 | 94 | <style lang="scss" scoped>
|
95 |
| - |
96 |
| -.gab { |
97 |
| - background-color: rgb(245, 245, 245); |
98 |
| - height: 20rpx; |
99 |
| -} |
| 95 | + .gab { |
| 96 | + background-color: rgb(245, 245, 245); |
| 97 | + height: 20rpx; |
| 98 | + } |
100 | 99 |
|
101 |
| -.wrap { |
102 |
| - height: 100vh; |
103 |
| - background-color: rgb(241, 241, 241); |
104 |
| -} |
| 100 | + .wrap { |
| 101 | + height: 100vh; |
| 102 | + background-color: rgb(241, 241, 241); |
| 103 | + } |
105 | 104 |
|
106 |
| -.box { |
107 |
| - padding: 30rpx 00rpx; |
108 |
| - font-size: 28rpx; |
109 |
| - color: $u-type-info; |
110 |
| - display: flex; |
111 |
| - align-items: center; |
112 |
| - justify-content: space-between; |
113 |
| -} |
| 105 | + .box { |
| 106 | + padding: 30rpx 00rpx; |
| 107 | + font-size: 28rpx; |
| 108 | + color: $u-type-info; |
| 109 | + display: flex; |
| 110 | + align-items: center; |
| 111 | + justify-content: space-between; |
| 112 | + } |
114 | 113 | </style>
|
0 commit comments