• layui


    表单

    1.lay-verify:注册form模块需要验证的类型

    2.lay-search:开启select的搜索功能

    3.lay-filter:为提交按钮设置该属性并在提交事件中绑定

    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="utf-8">
      <title>开始使用Layui</title>
      <meta name="renderer" content="webkit">
      <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
      <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
      <link rel="stylesheet" href="/layui/css/layui.css">
    </head>
    <body>
        <form class="layui-form layui-form-pane" action="">
            <div class="layui-form-item" pane>
                <label class="layui-form-label">图标</label>
                <div class="layui-input-block">
                    <i class="layui-icon">�</i> 
                    <i class="layui-icon" style="font-size: 30px; color: #1E9FFF;">�</i>  
                </div>
            </div>
            <div class="layui-form-item" pane>
                <label class="layui-form-label">按钮</label>
                <div class="layui-input-block">
                     <button class="layui-btn layui-btn-primary layui-btn-radius">原始按钮</button>
                     <button class="layui-btn layui-btn-radius">默认按钮</button>
                     <button class="layui-btn layui-btn-danger layui-btn-radius">警告按钮</button>
                </div>
            </div>
            <div class="layui-form-item" pane>
                <label class="layui-form-label">按钮</label>
                <div class="layui-input-block">
                     <button class="layui-btn">
                        <i class="layui-icon">�</i> 添加
                     </button>
                     <button class="layui-btn">
                        <i class="layui-icon">ဂ</i> 
                     </button>
                     <div class="layui-btn-group">
                        <button class="layui-btn layui-btn-small">
                            <i class="layui-icon">�</i>
                        </button>
                        <button class="layui-btn layui-btn-small">
                            <i class="layui-icon">�</i>
                        </button>
                        <button class="layui-btn layui-btn-small">
                            <i class="layui-icon">�</i>
                        </button>
                        <button class="layui-btn layui-btn-small">
                         <i class="layui-icon">�</i>
                        </button>
                    </div>
                </div>
            </div>
            <div class="layui-form-item" pane>
                <label class="layui-form-label">单选框</label>
                <div class="layui-input-block">
                    <input type="radio" name="sex" value="nan" title="男"> <input
                        type="radio" name="sex" value="nv" title="女" checked> <input
                        type="radio" name="sex" value="" title="中性" disabled>
                </div>
            </div>
    		<div class="layui-form-item">
    			<label class="layui-form-label">开关</label>
    			<div class="layui-input-block">
    				<input type="checkbox" name="switch" lay-skin="switch">
    			</div>
    		</div>
    		<div class="layui-form-item" pane>
                <label class="layui-form-label">复选框</label>
                <div class="layui-input-block">
                    <input type="checkbox" name="" title="写作"  checked>
                    <input type="checkbox" name="" title="发呆" lay-skin="primary">
                    <input type="checkbox" name="" title="禁用" lay-skin="primary"
                        disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">输入框</label>
                <div class="layui-input-block">
                    <input class="layui-input" type="text" required lay-verify="required" placeholder="请输入标题">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">密码框</label>
                <div class="layui-input-inline">
                    <input class="layui-input" type="password" placeholder="请输入密码">
                </div>
                <div class="layui-form-mid layui-word-aux">辅助文字</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">选择框</label>
                <div class="layui-input-block">
                    <select name="city" lay-verify="required">
                        <option value=""></option>
                        <option value="1">石家庄</option>
                        <option value="2">北京</option>
                        <option value="3">上海</option>
                        <option value="4">广州</option>
                        <option value="5">西安</option>
                    </select>
                </div>
            </div>
    		<div class="layui-form-item">
    			<label class="layui-form-label">文本域</label>
    			<div class="layui-input-block">
    				<textarea name="desc" placeholder="请输入内容" class="layui-textarea"></textarea>
    			</div>
    		</div>
    		<div class="layui-form-item">
    			<div class="layui-input-block">
    				<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
    				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
    			</div>
    		</div>
    	</form>
     
     
    	<script src="../../layui/layui.js"></script>
    <script> 
    //一般直接写在一个js文件中
    layui.use(['layer', 'form'], function(){
      var layer = layui.layer
      ,form = layui.form();
      
      //监听提交
      form.on('submit(formDemo)', function(data){
        layer.msg(JSON.stringify(data.field));
        return false;
      });
    });
    </script> 
      
    </body>
    </html>
    

      

  • 相关阅读:
    使用Visual Studio给SharePoint列表添加Event Receiver
    使用客户端对象模型回写SharePoint列表
    思考:通过源码进行安装的前提是什么
    思考:学习一门语言真的是仅仅只有为了使用吗?或者说学习一个语言如果在工作中不使用,那么学习它还有什么好处和价值呢?
    思考:(使用下载工具比如yum,maven等)下载(库或者jar)到本地都需要设置源
    思考:代码块的大小是进行代码抽出一个方法或者进行重构或者是否在设计时设计为一个方法的衡量因素之一吗?
    思考:对源的包装是为了更好的隔离和在中间插入一些层?
    Spring Cloud和Spring Boot的认识
    如何对待基础知识:
    为什么总觉得事情应付不过来,总觉得事情需要花费很多时间?
  • 原文地址:https://www.cnblogs.com/yongyuandishen/p/14152400.html
Copyright © 2020-2023  润新知