1.yaml array
texts:
-"mango"
-"apple"
-"banana"
The above yaml configuration file is equivalent to js writing method
var texts=["mango","apple","banana"]
Refer to the array of yaml configuration:
const texts = loader('')['texts']
2.Array in yaml array
-
-" mango "
-" apple "
-" banana "
It is equivalent to js writing:
[[' mango ',' apple ',' banana ']]
Three.yaml array adopts in-line notation
animal:[ ' mango ',' apple ',' banana ' ]
The conversion to js is written as:
{animal:[ ' mango ',' apple ',' banana ' ]}
4. Use objects and arrays in combination
friuts:
-" mango "
-" apple "
-" banana "
vegetables:
tomatoes:'red'
potatoes:'yellow'
green vegetables:'green'
The converted js is written as:
{
friuts:[ ' mango ',' apple ',' banana ' ],
vegetables:{
tomatoes:'red'
potatoes:'yellow'
green vegetables:'green'
}
}
For other configuration writing methods, please refer to: /blog/2016/07/