You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am new to working with YAML files and don't know the format well yet.
In addition, I got to know your module (thank you for your hard work) and am still trying to find my way around and continue to read the documentary in parallel.
My question refers to a parsed YAML file const doc = parseDocument(props.modelValue) I get over a gitlab api request.
How can I loop over the document? What is best practice here?
I'm using vue3 and currently my experimental way is the following:
// Parse YAML - props.modelValue is a yaml string, returned by gitlab file apiconstdocument=computed(()=>{if(typeofprops.modelValue==='string'){constdoc=parseDocument(props.modelValue)console.log('Parsed Document:',doc)returndoc}returnfalse})constdocItems=computed(()=>{if(document.value){constcontents=document.value.contentsasYAMLMapconsole.log('Items:',contents.items)returncontents?.items||false}returnfalse})<template><divv-for="(item, index) in docItems" :key="index">...</div></template>
That way I can use a v-for loop.
Thanks for helping.
//Edit:
Something like a doc.getKeys() function (or doc.get() without a path) is what I would like to see.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I am new to working with YAML files and don't know the format well yet.
In addition, I got to know your module (thank you for your hard work) and am still trying to find my way around and continue to read the documentary in parallel.
My question refers to a parsed YAML file
const doc = parseDocument(props.modelValue)
I get over a gitlab api request.How can I loop over the document? What is best practice here?
I'm using vue3 and currently my experimental way is the following:
That way I can use a
v-for
loop.Thanks for helping.
//Edit:
Something like a
doc.getKeys()
function (ordoc.get()
without a path) is what I would like to see.Beta Was this translation helpful? Give feedback.
All reactions