Browse Source

始宁农业小程序:样式

panyong 2 years ago
parent
commit
4aa794599e

+ 7 - 4
htmldev/shiningWxMini/pages/mediaDetail/mediaDetail.js

@@ -17,7 +17,7 @@ Page({
       comment: ''
     },
     booLock: false,
-    inputPosition: 'fixed'
+    inputBoxStyle: 'bottom:0;'
   },
   ...pages.methods,
   /**
@@ -96,10 +96,13 @@ Page({
       imageUrl: video_cover_url
     }
   },
-  handleFocus() {
-    const sys = wx.getSystemInfoSync()
+  handleFocus(event) {
+    const height = event.detail.height
+    this.setData({ inputBoxStyle: `bottom:${height}px;` })
+  },
+  handleBlur() {
+    this.setData({ inputBoxStyle: `bottom:0;` })
   },
-  handleBlur() {},
   setComment(event) {
     const { value } = event.detail
 

+ 2 - 2
htmldev/shiningWxMini/pages/mediaDetail/mediaDetail.wxml

@@ -50,7 +50,7 @@
 
 <view
   class="footer-fixed-bottom"
-  style="box-shadow: none;position: {{inputPosition}}">
+  style="box-shadow: none;{{inputBoxStyle}}">
   <view>
     <view class="form-item">
       <image
@@ -60,7 +60,7 @@
         placeholder-class="placeholder"
         value="{{form.comment}}"
         placeholder="说点什么吧..."
-        :cursor-spacing="{{60}}"
+        adjust-position="{{false}}"
         bind:focus="handleFocus"
         bind:blur="handleBlur"
         bind:input="setComment"></input>