如何映射多个配置文件

时间:2016-03-16 10:23:57

标签: lua openwrt luci

关于openwrt luci的工作。我有多个配置文件,如:网络无线面临的问题。我使用下面的语法进行映射

m = Map("network", translate("Wireless Settings"))

如何在一个模型中映射多个配置文件

1 个答案:

答案 0 :(得分:2)

要使用 map(),首先我们需要清楚地了解地图定义和属性。这是地图定义

class Map (config, title, description)

这是模型的根对象。

  • config:要映射的配置名称,请参阅uci文档和 / etc / config
  • 中的文件
  • 标题:标题中显示的标题
  • 描述:UI中显示的说明

您有两个配置网络无线。好吧,让我们开始多个配置文件绑定过程。首先我们使用网络配置文件进行映射,然后使用无线配置文件进行映射

使用网络配置文件进行地图

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

通过这种方式,您可以在一个模型中映射多个配置文件。

相关问题