动态生成下拉选择

根据接口动态获取下拉选择

参数 说明 类型 是否必填 默认值 备注
data-select 拉下选择 string 参数值为请求的url
data-fields 查询的字段 string
data-value 下拉选中的值 string

代码示例

<div class="layui-form-item">
    <label class="layui-form-label">商品分类</label>
    <div class="layui-input-block">
        <select name="cate_id" lay-verify="required" data-select="{:url('mall.cate/index')}" data-fields="id,title" data-value="{$row.cate_id|default=''}">
        </select>
    </div>
</div>

返回的json格式

{
    "code": 1,
    "msg": null,
    "data": [{
        "id": 9,
        "title": "手机"
    }, {
        "id": 10,
        "title": "家用"
    }, {
        "id": 11,
        "title": "如何"
    }],
    "url": "http:\/\/admin.host\/admin\/mall.goods\/edit?id=8",
    "wait": 3
}
© zhongshaofa all right reserved,powered by Gitbook文件修订时间: 2024-07-18 16:42:59

results matching ""

    No results matching ""

    results matching ""

      No results matching ""