zoukankan      html  css  js  c++  java
  • angularJS的ng-keyup

    直接上代码我没写指令直接这么用的:

    html:

    <div class="box_ft_cont">
            <div class="chat_text">
                   <textarea id="serializeInfo" data-ng-trim="false" ng-model="chat.sendContent" ng-keyup="sendChats($event)" ui-jq="slimScroll" ui-options="{height:'100%', size:'8px', '100%'}" type="text" class="chat-cont"></textarea>
             </div>
             <p class="chat-btn">
                     <span>按enter键发送</span>
                      <button type="submit" ng-click="sendChat()" class="btn btn-primary"><i class="fa fa-paper-plane"></i></button>
             </p>
     </div>

    js部分:

      //发送消息
      $scope.sendChat = function () {
          var message = {};
          message.fromUserName = "";
          message.toUserName = $scope.chat.currUserId;
          message.content = $scope.chat.sendContent;
          message.msgType = 0;
          message.sendTime = $filter('date')(new Date(), "yyyy-MM-dd hh:mm:ss");
    
          myWebsocket.sendMessage(message);
          $scope.chat.sendContent = null;
      }
      $scope.sendChats = function (event) {
          if (event.keyCode == 13) {
              $scope.sendChat();
              return false;
          }
      }
  • 相关阅读:
    MySQLSource-Flume
    Flume
    Hive| ETL清洗& 查询练习
    Hive-04 压缩| 存储
    Hive-03 查询
    Hive-02 DDL| DML
    shell基本用法
    Hive-01 配置| 架构原理
    HDFS-HA高可用 | Yarn-HA
    react-路由和Ant design
  • 原文地址:https://www.cnblogs.com/bertha-zm/p/8043800.html
Copyright © 2011-2022 走看看