console
layui.use('form', function () {
var form = layui.form;
form.on('submit(formDemo)', function (data) {
layer.msg(JSON.stringify(data.field));
return false;
});
});
layui.use(['element', 'jquery', 'layer'], function () {
var $ = layui.jquery;
var element = layui.element;
var layer = layui.layer;
//alert
$("#btn1").click(function () {
//input here
layer.open({
type: 1,
title: '',
shadeClose: true,
shade: 0.8,
area: ['580px', '392px'],
shadeClose: false,
content: `
<table id="demo2" lay-filter="test"></table>
`
});
});
});
layui.use(['table', 'jquery', 'layer'], function () {
var table = layui.table;
table.render({
elem: '#demo',
height: 315,
cols: [[
{ align: 'center', title: '文本区域', colspan: 3 }
, { align: 'center', title: '链接区域', colspan: 3 }
], [
{ field: 'province', title: '序号', align: 'center',width: 80 }
, { field: 'city', title: '词项', align: 'center',width: 200 }
, { field: 'county', title: '次数',align: 'center', width: 80 }
, { field: 'province', title: '序号', align: 'center',width: 80 }
, { field: 'city', title: '词项',align: 'center', width: 200 }
, { field: 'county', title: '次数',align: 'center', width: 80 }
]],
data: [{ username: '1', amount: 333, province: 'fujian', city: 'sanming', county: 'hha' }]
});
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>词频统计</title>
<style type="text/css">
.layer-photos-demo {
margin: 10px 0;
}
.layer-photos-demo img {
width: 160px;
height: 100px;
}
</style>
</head>
<body class="layui-layout-body">
<button class=layui-btn id="setWord">配置词语</button>
<button class=layui-btn id="update">更新统计</button>
<div style="width:720px">
<table id="demo" lay-filter="test"></table>
</div>
</body>
</html>