美文网首页
PHP+layui的xm-select下拉多选使用

PHP+layui的xm-select下拉多选使用

作者: G加号 | 来源:发表于2022-06-21 16:38 被阅读0次

手册:https://maplemei.gitee.io/xm-select/#/component/install

html:

<span style="display: none;" id="list">{$list_2}</span>
<div id="demo2" class="xm-select-demo"></div>

js:

$(function(){
    var getList = $("#list").text();
    getList = JSON.parse(getList);
    console.log(getList)
    var demo1 = xmSelect.render({
        el: '#demo2',
        autoRow: true,  //自动换行
        filterable: true,   // 搜索
        data: getList,
    })

})

php(tp5):

$list_2 = db('表名')
            ->field("id value,nickname name")
            ->select();
return $this->fetch('', ['list_2'=>json_encode($list_2,JSON_UNESCAPED_UNICODE)]);

相关文章

网友评论

      本文标题:PHP+layui的xm-select下拉多选使用

      本文链接:https://www.haomeiwen.com/subject/vodevrtx.html