- 1
- 2
- 3
- 4
- 5
OpenWrtWeb界面修改及功能实现实例说明
资料介绍
OpenWrt Web 界面修改及功能实现实例说明
本文将以一个页面为例,来说明Lua 语言如何实现页面控件以及怎么使输入或操作的选项在系统中生效。
页面如图所示:
首先,我们要在System 栏下建立分页"Test by Wayne" ,使用cbi 模块实现,修改目录lua\luci\controller\admin 下的system.lua 文
件。
在function index() 中添加语句:
entry({ "admin" , "system" , "test" }, cbi( "admin_system/test" ), "Test by Wayne", 30).dependent
=false
接下来就需要在lua\luci\model\cbi\admin_system 中创建test.lua 文件并完成控件元素编辑。
上一篇文章中已经说过,所有的控件都由Map 开始,在这里我测试的是网络设置,语句如下:
m = Map("network" , translate( "Test Page by Wayne (~_~)" ), translate( "On this page w
e can learn how the .lua works." ))
然后需要创建分块”Network Configuration ” 。创建section 之前,需要在etc/config 目录下的network 文件中添加一个配置,就取名叫
netset 吧, network 文件如下:
config 'interface' 'loopback'
option 'ifname' 'lo'
option 'proto' 'static'
⋯⋯
config 'interface' 'lan'
option 'ifname' 'eth0'
option 'type' 'bridge'
option 'proto' 'static'
⋯⋯
config 'netset'
部分文件列表
| 文件名 | 大小 |
| OpenWrtWeb界面修改及功能实现实例说明.pdf | 201K |
最新上传
-
21ic小能手 打赏10.00元 3天前
-
21ic小能手 打赏10.00元 3天前
-
21ic小能手 打赏5.00元 3天前
-
21ic下载 打赏310.00元 3天前
用户:江岚
-
21ic下载 打赏310.00元 3天前
用户:mulanhk
-
21ic下载 打赏320.00元 3天前
用户:jh03551
-
21ic下载 打赏220.00元 3天前
用户:jh0355
-
21ic下载 打赏210.00元 3天前
用户:潇潇江南
-
21ic下载 打赏210.00元 3天前
用户:小猫做电路
-
21ic下载 打赏60.00元 3天前
用户:gsy幸运
-
21ic下载 打赏60.00元 3天前
用户:zhengdai
-
21ic下载 打赏60.00元 3天前
用户:lanmukk
-
21ic下载 打赏60.00元 3天前
用户:烟雨
-
21ic下载 打赏20.00元 3天前
用户:w993263495
-
21ic下载 打赏30.00元 3天前
用户:sun2152
-
21ic下载 打赏20.00元 3天前
用户:w178191520
-
21ic下载 打赏20.00元 3天前
用户:liqiang9090
-
21ic下载 打赏20.00元 3天前
用户:xuzhen1
-
21ic下载 打赏35.00元 3天前
用户:有理想666
-
21ic下载 打赏15.00元 3天前
用户:w1966891335
-
21ic下载 打赏15.00元 3天前
用户:x15580286248
-
21ic下载 打赏25.00元 3天前
用户:qiufeng0299
-
21ic下载 打赏15.00元 3天前
用户:kk1957135547
-
21ic下载 打赏10.00元 3天前
用户:qingsong08
-
21ic下载 打赏10.00元 3天前
用户:电工老刘
-
21ic小能手 打赏5.00元 3天前
-
21ic小能手 打赏5.00元 3天前
-
21ic小能手 打赏5.00元 3天前
-
ZENGYIBIN 打赏1.00元 3天前
-
21ic小能手 打赏10.00元 3天前
-
21ic小能手 打赏5.00元 3天前
-
21ic小能手 打赏5.00元 3天前
-
21ic小能手 打赏5.00元 3天前
-
21ic小能手 打赏5.00元 3天前
资料:STM32的数字万用表
-
21ic小能手 打赏5.00元 3天前
-
kuangwy 打赏1.00元 3天前
-
21ic小能手 打赏5.00元 3天前
资料:触控无极台灯控制方案
-
21ic小能手 打赏5.00元 3天前
-
21ic小能手 打赏5.00元 3天前
-
21ic小能手 打赏5.00元 3天前
资料:51单片机的汽车雨刷器




全部评论(0)