yaml配置数组写法

一.yaml数组html

texts:

-"mango"数组

-"apple"app

-"banana"htm

以上yaml配置文件等同于的js写法对象

var texts=["mango","apple","banana"]

引用该yaml配置的数组:blog

const texts = loader('texts.yaml')['texts']

二.yaml数组中的数组get

-

-" mango "table

-" apple "配置

-" banana "引用

等同于js写法:

[[' mango ',' apple ',' banana ']]

三.yaml数组采用行内表示法

animal:[ ' mango ',' apple ',' banana ' ]

转换成js写法为:

{animal:[ ' mango ',' apple ',' banana ' ]}

四.对象和数组结合使用

friuts:

-" mango "

-" apple "

-" banana "

vegetables:

tomatoes:'red'

potatoes:'yellow'

green vegetables:'green'

转成的js写法为:

{

friuts:[ ' mango ',' apple ',' banana ' ],

vegetables:{

tomatoes:'red'

potatoes:'yellow'

green vegetables:'green'

}

}

除此外的其余配置写法可参照:http://www.ruanyifeng.com/blo...

相关文章
相关标签/搜索