123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <title>代码修饰</title>
- <div class="layui-card layadmin-header">
- <div class="layui-breadcrumb" lay-filter="breadcrumb">
- <a lay-href="">主页</a>
- <a><cite>组件</cite></a>
- <a><cite>代码修饰</cite></a>
- </div>
- </div>
-
- <div class="layui-fluid">
- <div class="layui-row layui-col-space15">
- <div class="layui-col-md12">
- <div class="layui-card">
- <div class="layui-card-header">默认修饰</div>
- <div class="layui-card-body">
- <pre class="layui-code">//在里面存放任意的代码
- Lay.fn.event = function(modName, events, params){
- var that = this, result = null, filter = events.match(/\(.*\)$/)||[];
- var set = (events = modName + '.'+ events).replace(filter, '');
- };
- </pre>
- </div>
- </div>
-
- <div class="layui-card">
- <div class="layui-card-header">notepad风格</div>
- <div class="layui-card-body">
- <pre class="layui-code" lay-title="JavaScript" lay-skin="notepad">//代码区域
- Lay.fn.event = function(modName, events, params){
- var that = this, result = null, filter = events.match(/\(.*\)$/)||[];
- var set = (events = modName + '.'+ events).replace(filter, '');
- };
- </pre>
- </div>
- </div>
-
- <div class="layui-card">
- <div class="layui-card-header">代码中的代码</div>
- <div class="layui-card-body">
- <pre class="layui-code">//代码区域
- Lay.fn.event = function(modName, events, params){
- var that = this, result = null, filter = events.match(/\(.*\)$/)||[];
- var set = (events = modName + '.'+ events).replace(filter, '');
- };
- <pre class="layui-code">//代码区域
- Lay.fn.event = function(modName, events, params){
- var that = this, result = null, filter = events.match(/\(.*\)$/)||[];
- var set = (events = modName + '.'+ events).replace(filter, '');
- };
- </pre>
- </pre>
-
- <pre class="layui-code" lay-skin="notepad">//代码区域
- Lay.fn.event = function(modName, events, params){
- var that = this, result = null, filter = events.match(/\(.*\)$/)||[];
- var set = (events = modName + '.'+ events).replace(filter, '');
- };
- <pre class="layui-code" lay-skin="notepad">//代码区域
- Lay.fn.event = function(modName, events, params){
- var that = this, result = null, filter = events.match(/\(.*\)$/)||[];
- var set = (events = modName + '.'+ events).replace(filter, '');
- };
- <pre class="layui-code" lay-skin="notepad">//代码区域
- Lay.fn.event = function(modName, events, params){
- var that = this, result = null, filter = events.match(/\(.*\)$/)||[];
- var set = (events = modName + '.'+ events).replace(filter, '');
- };
- <pre class="layui-code" lay-skin="notepad">//代码区域
- Lay.fn.event = function(modName, events, params){
- var that = this, result = null, filter = events.match(/\(.*\)$/)||[];
- var set = (events = modName + '.'+ events).replace(filter, '');
- };
- <pre class="layui-code" lay-skin="notepad">//代码区域
- Lay.fn.event = function(modName, events, params){
- var that = this, result = null, filter = events.match(/\(.*\)$/)||[];
- var set = (events = modName + '.'+ events).replace(filter, '');
- };
- </pre>
- </pre>
- </pre>
- </pre>
- </pre>
- </div>
- </div>
-
- <div class="layui-card">
- <div class="layui-card-header">固定高度</div>
- <div class="layui-card-body">
- <pre class="layui-code" lay-height="150px">//代码区域
- Lay.fn.event = function(modName, events, params){
- var that = this, result = null, filter = events.match(/\(.*\)$/)||[]; //提取事件过滤器
- var set = (events = modName + '.'+ events).replace(filter, ''); //获取事件本体名
- var callback = function(_, item){
- var res = item && item.call(that, params);
- res === false && result === null && (result = false);
- };
- layui.each(config.event[set], callback);
- filter[0] && layui.each(config.event[events], callback); //执行过滤器中的事件
- return result;
- };
- </pre>
- </div>
- </div>
-
- <div class="layui-card">
- <div class="layui-card-header">XXX</div>
- <div class="layui-card-body">
-
- </div>
- </div>
-
- <div class="layui-card">
- <div class="layui-card-header">XXX</div>
- <div class="layui-card-body">
-
- </div>
- </div>
-
- <div class="layui-card">
- <div class="layui-card-header">XXX</div>
- <div class="layui-card-body">
-
- </div>
- </div>
-
- </div>
- </div>
- </div>
-
- <script>
- layui.use(['admin', 'code'], function(){
-
- layui.code({
- elem: 'pre'
- });
-
- });
- </script>
|