添加组件及页面
This commit is contained in:
@@ -16,9 +16,9 @@ Component({
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
setTimeout(() => {
|
||||
this.getSlotHeight();
|
||||
}, 100);
|
||||
// setTimeout(() => {
|
||||
// this.getSlotHeight();
|
||||
// }, 100);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -27,7 +27,7 @@ Component({
|
||||
*/
|
||||
data: {
|
||||
showMore: false,
|
||||
showMoreBar: false,
|
||||
showMoreBar: true,
|
||||
},
|
||||
/**
|
||||
* 组件的方法列表
|
||||
@@ -38,7 +38,7 @@ Component({
|
||||
const query = wx.createSelectorQuery().in(this);
|
||||
// 2. 查询插槽容器节点
|
||||
query
|
||||
.select("#contentSlot")
|
||||
.select('#contentSlot')
|
||||
.boundingClientRect((rect) => {
|
||||
if (rect) {
|
||||
const height = rect.height; // 获取节点高度(单位px)
|
||||
@@ -54,7 +54,7 @@ Component({
|
||||
.exec(); // 执行查询
|
||||
},
|
||||
click(e: any) {
|
||||
this.triggerEvent("tap", e);
|
||||
this.triggerEvent('tap', e);
|
||||
},
|
||||
showMoreTap() {
|
||||
this.setData({
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
<view class="card_plugin {{className}}" style="border: 1rpx solid #ddd;margin-bottom: 12px;border-radius: 4px;{{customStyle}}" bind:tap="click">
|
||||
<view class="header" style="border-bottom: 1rpx solid #ddd;padding: 8px 12px;font-weight: bold;{{headerStyle || ''}}">
|
||||
<view class="card_plugin {{className}}"
|
||||
style="border: 1rpx solid #ddd;margin-bottom: 24rpx;border-radius: 8rpx;{{customStyle}}"
|
||||
bind:tap="click">
|
||||
<view class="header"
|
||||
style="border-bottom: 1rpx solid #ddd;padding: 16rpx 24rpx;font-weight: bold;{{headerStyle || ''}}">
|
||||
<slot name="header" />
|
||||
</view>
|
||||
<view class="content" style="padding:8px 12px;{{contentStyle || ''}}">
|
||||
<view id="contentSlot" style="height: {{showMoreBar ? showMore ? 'auto' : 'calc(3em * 1.57)' : 'auto'}};overflow: hidden;">
|
||||
<view class="content" style="padding:16rpx 24rpx;{{contentStyle || ''}}">
|
||||
<view id="contentSlot"
|
||||
style="height: {{showMoreBar ? showMore ? 'auto' : 'calc(3em * 1.57)' : 'auto'}};overflow: hidden;">
|
||||
<slot name="content" />
|
||||
</view>
|
||||
<view wx:if="{{showMoreBar}}" class="show-more" catch:tap="showMoreTap">
|
||||
@@ -14,5 +18,4 @@
|
||||
<view class="footer" style="{{footerStyle||''}}">
|
||||
<slot name="footer" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
Reference in New Issue
Block a user