2

在openwrt luci上工作。我有多个配置文件,例如:映射中的网络无线面部问题。我使用以下语法进行映射

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

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

4

1 回答 1

2

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

class Map (config, title, description)

这是模型的根对象。

  • config:要映射的配置名称,参见 uci 文档和 /etc/config 中的文件
  • 标题:在 UI 中显示的标题
  • 描述:在 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

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

于 2016-03-16T14:30:18.780 回答