1 Star 0 Fork 14

dizhu/Light Year Admin Using v5 For Example

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
lyear_js_bootstrap_selectN.html 5.96 KB
一键复制 编辑 原始数据 按行查看 历史
笔下光年 提交于 2022-12-10 17:27 . feat:代码上传
<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="Light Year Admin V5是一个基于Bootstrap v5.1.3的后台管理系统的HTML模板。">
<title>联动插件bootstrap-selectN - 光年(Light Year Admin V4)后台管理系统模板</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="stylesheet" type="text/css" href="css/materialdesignicons.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.min.css">
<style>
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="card">
<header class="card-header">
<div class="card-title">联动插件 bootstrap-selectN</div>
</header>
<div class="card-body">
<p>该插件是基于layui的一个插件selectN.js,这里去掉了原有layui的东西,根据基本的使用需求做了些修改而改成的一个jquery插件。</p>
<p><strong>简单使用</strong></p>
<div class="mb-3">
<div id="example-1"></div>
</div>
<pre>var catIns1 = $('#example-1').bootstrapSelectN({
data: catData,
});</pre>
<p><strong>设置空值项提示</strong></p>
<div class="mb-3">
<div id="example-2"></div>
</div>
<pre>var catIns2 = $('#example-2').bootstrapSelectN({
data: catData,
placeholder: ['设置一', '设置二', '设置三'],
});</pre>
<p><strong>设置宽度</strong></p>
<p>可单个使用,也可使用数组形式。<code>['120px', '190px', '200px']</code></p>
<div class="mb-3">
<div id="example-3"></div>
</div>
<pre>var catIns3 = $('#example-3').bootstrapSelectN({
data: catData,
width: '190px', // 设置实际长度或者百分比长度,当form表单的class="form-horizontal"时可以使用col-*
});</pre>
<p><strong>表单中使用</strong></p>
<form class="form-horizontal">
<div class="mb-3 row">
<label class="col-md-12 form-label" for="title">标题</label>
<div class="col-sm-12">
<input type="email" class="form-control" id="title" placeholder="Email">
</div>
</div>
<div class="mb-3 row">
<label class="col-md-12 form-label">分类</label>
<div id="example-4" class="col-md-12 row"></div>
</div>
</form>
<pre>var catIns4 = $('#example-4').linkageSelect({
data: catData,
width: 'col-md-3',
});</pre>
<p><strong>url地址获取json数据</strong></p>
<div class="mb-3">
<div id="example-5"></div>
</div>
<pre>var catIns5 = $('#example-5').bootstrapSelectN({
data: 'data_selectN_json.php',
});</pre>
<p><strong>指定已选中值</strong></p>
<div class="mb-3">
<div id="example-6"></div>
</div>
<pre>var catIns6 = $('#example-6').bootstrapSelectN({
data: catData,
selected: [6,10,11,20,21,22]
});</pre>
<button class="btn btn-default">获取值</button>
<pre id="log" class="mt-2"></pre>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/popper.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
<script type="text/javascript" src="js/bootstrap-selectN.js"></script>
<script type="text/javascript">
var catData = [{"id":1,"name":"周边旅游","children":[{"id":24,"name":"广东","status":0,"children":[{"id":7,"name":"广州"},{"id":23,"name":"潮州"}]}]},{"id":5,"name":"国内旅游","children":[{"id":8,"name":"华北地区","children":[{"id":9,"name":"北京"}]}]},{"id":6,"name":"出境旅游","children":[{"id":10,"name":"东南亚","children":[{"id":11,"name":"马来西亚","children":[{"id":20,"name":"沙巴","children":[{"id":21,"name":"美人鱼岛","children":[{"id":22,"name":"潜水"}]}]}]}]}]}];
var catIns1 = $('#example-1').bootstrapSelectN({
data: catData,
});
var catIns2 = $('#example-2').bootstrapSelectN({
data: catData,
placeholder: ['设置一', '设置二', '设置三'],
});
var catIns3 = $('#example-3').bootstrapSelectN({
data: catData,
width: '190px', // 设置实际长度或者百分比长度,当form表单的class="form-horizontal"时可以使用col-*
});
var catIns4 = $('#example-4').bootstrapSelectN({
data: catData,
width: 'col-md-3',
});
var catIns5 = $('#example-5').bootstrapSelectN({
data: './data/lyear_data_selectN_json.php',
placeholder: ['请选择省', '请选择市', '请选择县/区'],
});
var catIns6 = $('#example-6').bootstrapSelectN({
data: catData,
selected: [6,10,11,20,21,22]
});
$('.btn').on('click', function(){
var logbox = $('#log');
logbox.append('catIns1 当前选中的值:', catIns1.values+'\n');
logbox.append('catIns2 当前选中的值:', catIns2.values+'\n');
logbox.append('catIns3 当前选中的值:', catIns3.values+'\n');
logbox.append('catIns4 当前选中的值:', catIns4.values+'\n');
logbox.append('catIns5 当前选中的值:', catIns5.values+'\n');
logbox.append('catIns6 当前选中的值:', catIns6.values+'\n');
});
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
HTML
1
https://gitee.com/johnnyhg/light-year-admin-using-v5-for-example.git
[email protected]:johnnyhg/light-year-admin-using-v5-for-example.git
johnnyhg
light-year-admin-using-v5-for-example
Light Year Admin Using v5 For Example
master

搜索帮助