在openwrt luci上工作。我有多个配置文件,例如:映射中的网络和无线面部问题。我使用以下语法进行映射
m = Map("network", translate("Wireless Settings"))
如何在一个模型中映射多个配置文件
要使用map(),首先我们需要清楚地了解带有属性的地图定义。这是地图定义
class Map (config, title, description)
这是模型的根对象。
你有两个配置网络和无线。好的,让我们开始多个配置文件绑定过程。首先我们映射网络配置文件,然后我们映射无线配置文件
使用网络配置文件映射
m = Map("network", translate("Wireless Settings")) -- We want to edit the uci config file /etc/config/network
m:chain("wireless")
s = m:section(NamedSection, "wan", "") -- Especially the "interface"-sections
注意: m:chain("config") 绑定第二个配置文件
使用无线配置文件映射
m1 = Map("wireless","Wireless Network") -- We want to edit the uci config file /etc/config/network
s1 = m1:section(NamedSection,"wifi-iface", "") -- Especially the "interface"-sections
现在渲染我们需要返回我的地图模型对象
return m,m1
通过这种方式,您可以在一个模型中映射多个配置文件。