一.yaml数组
texts:
-"mango"
-"apple"
-"banana"
以上yaml配置文件等同于的js写法
var texts=["mango","apple","banana"]
引用该yaml配置的数组:
const texts = loader('')['texts']
二.yaml数组中的数组
-
-" mango "
-" 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'
}
}
除此外的其他配置写法可参照:/blog/2016/07/