Micro letter applet textarea penetrating questions

       Micro-channel input applet large blocks of text, use the textarea component, but the highest level of native components, resulting in a pop and other components, just click on pop interface will get textarea click event to display the cursor.

       1. micro-channel official website recommended the use of cover-view components include button, then if there is text and other components, the compiler will prompt abnormal, cover-view only supports several controls. In the above simulator, it can already be achieved not get textarea control, but the real machine preview, or not, need to add z-index to the highest level.

.cover{
  z-index: 999;
}

2. The page chat because I was doing when this problem occurs, chat interface selection window pop other times, not pay attention to what each control will slide above the textarea click, so think of a compromise, is to have pop arise when , the textarea is set to hidden: true, popups closed when set to hidden: false,

 <textarea id="textmsg" hidden="{{textareaHidden}}" class="chat-input" auto-height="{{inputAutoH}}" style="height:{{inputHeight}}rpx" bindlinechange="bindInputChange" bindinput="bindInput" value="{{inputMsg}}" contenteditable="true" maxlength="140" cursor-spacing="10"></textarea>

Then set the pop function monitor, monitor closed event,

component.closeCallback({
      close: (res) => {
        that.setData({
          textareaHidden: res
        })
      }
    })

Components inside, click the Close event listener function to achieve

    var closeCallback = null

    /**
     * 设置关闭按钮监听
     */
    closeCallback(data) {
      closeCallback = data
    },
/**
* 关闭按钮
*/
onCloseClick: function() {
  console.log("closeCallback=" + closeCallback)
  this.setData({
    visible: false
  })
  if (closeCallback) {
    closeCallback.close(false)
  }
}

 

Released three original articles · won praise 0 · Views 113

Guess you like

Origin blog.csdn.net/lixiangping110/article/details/104618952