فهرست منبع

全屏弹出层

zhaoxiaohai 3 سال پیش
والد
کامیت
9a383d7b0a

+ 40 - 0
pages/threadedTree/modules/popup/index.js

@@ -0,0 +1,40 @@
+// pages/threadedTree/modules/popup/index.js
+Component({
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+        sheetTitle: String
+    },
+
+    lifetimes: {
+        ready: function () {
+            const that = this;
+            wx.getSystemInfo({
+                success: (res => that.setData({
+                    scrollHeight: res.windowHeight - 90
+                }))
+            });
+        }
+    },
+    /**
+     * 组件的初始数据
+     */
+    data: {
+        scrollHeight: 0
+    },
+
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        /* 关闭弹窗 */
+        sheetClose() {
+            let pages = getCurrentPages(),
+                prevPage = pages[pages.length - 1];
+            prevPage.setData({
+                sheetTitle: ""
+            })
+        },
+    }
+})

+ 4 - 0
pages/threadedTree/modules/popup/index.json

@@ -0,0 +1,4 @@
+{
+    "component": true,
+    "usingComponents": {}
+}

+ 13 - 0
pages/threadedTree/modules/popup/index.scss

@@ -0,0 +1,13 @@
+/* 弹窗 */
+.popup {
+    .header {
+        width: 100%;
+        height: 90rpx;
+        line-height: 90rpx;
+        text-align: center;
+        border-bottom: 1px solid #EEEEEE;
+        font-size: 28rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #333333;
+    }
+}

+ 6 - 0
pages/threadedTree/modules/popup/index.wxml

@@ -0,0 +1,6 @@
+<van-popup class="popup" show="{{ sheetTitle }}" custom-style="height: 100vh;" position="bottom" round closeable bind:close='sheetClose'>
+    <view class="header">{{sheetTitle}}</view>
+    <scroll-view scroll-y style="height:{{scrollHeight}}px;">
+        <slot />
+    </scroll-view>
+</van-popup>