update
This commit is contained in:
+57
-4
@@ -32,22 +32,75 @@
|
|||||||
, dropdown = layui.dropdown //下拉菜单
|
, dropdown = layui.dropdown //下拉菜单
|
||||||
});
|
});
|
||||||
|
|
||||||
$(function () {
|
// 定义function
|
||||||
|
const listView = function (options) {
|
||||||
|
// 当前页
|
||||||
|
this.current_page = 1
|
||||||
|
// 每页条数
|
||||||
|
this.limit = 50
|
||||||
|
|
||||||
|
this.options = options
|
||||||
|
this.opts = {"h": 'oo'}
|
||||||
|
}
|
||||||
|
|
||||||
|
listView.prototype = {
|
||||||
|
init: function () {
|
||||||
|
this.merge_obj(this.opts, this.options)
|
||||||
|
},
|
||||||
|
// 获取数据
|
||||||
|
fetch_data: function () {
|
||||||
|
console.log(this.opts)
|
||||||
|
},
|
||||||
|
// 显示分页组件
|
||||||
|
auto_page_bar: function () {
|
||||||
|
const me = this
|
||||||
//执行一个laypage实例
|
//执行一个laypage实例
|
||||||
laypage.render({
|
laypage.render({
|
||||||
elem: 'page_bar' //注意,这里的 test1 是 ID,不用加 # 号
|
elem: 'page_bar' //注意,这里的 test1 是 ID,不用加 # 号
|
||||||
, count: 50 //数据总数,从服务端得到
|
, count: 50 //数据总数,从服务端得到
|
||||||
, limit: 20 // 每页显示的条数。
|
, limit: me.limit // 每页显示的条数。
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
merge_obj: function (target, src) {
|
||||||
|
for (var o in src) {
|
||||||
|
if (o in target) {
|
||||||
|
if (typeof target[o] === 'object' && Object.prototype.toString.call(target[o]).toLowerCase() === '[object object]' && !target[o].length) {
|
||||||
|
this.merge(target[o], src[o]);
|
||||||
|
} else {
|
||||||
|
target[o] = src[o];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
target[o] = src[o];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
// 初始化对象
|
||||||
|
const list_view = new listView({'s': 'p'})
|
||||||
|
list_view.init()
|
||||||
|
list_view.fetch_data()
|
||||||
|
|
||||||
|
// 绑定事件
|
||||||
|
$('#c_').click(function () {
|
||||||
|
const mind_name = $('#mind_name').val()
|
||||||
|
if (mind_name) {
|
||||||
|
list_view.fetch_data()
|
||||||
|
} else {
|
||||||
|
layer.msg('请输入导图名称')
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div style="margin-top: 5px;">
|
<div style="margin-top: 5px;">
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="password" name="password" required lay-verify="required" placeholder="请输入思维导图名称" autocomplete="off" class="layui-input">
|
<input type="password" name="password" required lay-verify="required" placeholder="请输入思维导图名称" autocomplete="off" class="layui-input" id="mind_name">
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="layui-btn">创建导图</button>
|
<button type="button" class="layui-btn" id="c_">创建导图</button>
|
||||||
<button type="button" class="layui-btn">搜索</button>
|
<button type="button" class="layui-btn">搜索</button>
|
||||||
</div>
|
</div>
|
||||||
<table class="layui-table">
|
<table class="layui-table">
|
||||||
|
|||||||
Reference in New Issue
Block a user