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...

相關文章
相關標籤/搜索