Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
186 views
in Technique[技术] by (71.8m points)

javascript - Vue.js中的嵌套对象(Nested object in Vue.js)

I have json object and i don't know how it looks, it can be nested.

(我有json对象,我不知道它的外观,可以嵌套。)

How to display this object with nested objects as li elements.

(如何使用嵌套对象作为li元素显示此对象。)

I try to find and I can't find proper answer.

(我尝试找到但找不到正确的答案。)

  ask by Micha? Kruk translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

first is the Object everytime different or is it always the same Object?

(首先是对象每次都是不同的还是总是相同的对象?)

If it is always the same nestet Object you can print it to the console using console.log("my nested Object", nestedObject")

(如果始终是同一嵌套对象,则可以使用console.log("my nested Object", nestedObject")将其打印到控制台。)

If it's structure is everytime different you have to write yourself a parser to write it into an object where you know the structure of your Object and then you can simply print it as li using v-for or multiple nested v-for loops dependend on your Object.

(如果结构每次都不相同,则必须编写一个解析器以将其写入知道对象结构的对象中,然后可以简单地使用v-for或多个嵌套的v-for循环将其打印为li,这取决于您的宾语。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...