前文讲到网页访问自定义事件的方法,如果有很多事件需要定义怎么办?当然可以继续用前文的方法,不过这里有一种更为简洁的方法。
一、引入layui.css样式文件
在<head>标签写代码:
<link rel="stylesheet" herf="/static/.../layui.css" media="all">
二、引入layui.js文件
在<body>标签内写代码:
<script src="/static/.../layui.js"></script>
三、写自定义的script代码