我正在尝试解析我的 Laravel 应用程序为我的 Vue 视图提供的 JSON 字符串。JSON 字符串可能如下所示:{ "1":[ { "row":"Some text here on first column." }, { "row":"And more text. Second row." }, { "row":"Text!" } ], "2":[ { "row":"2nd column text." }, { "row":"" } ], "3":[ { "row":"Even more text. But on the third column." } ]}这里需要注意的事项:“1”、“2”和“3”指的是列。所以在上面的例子中,我有 3 列。每个“行”是指列中的一行。我正在尝试将字符串解析为表格,例如:https : //jsfiddle.net/59bz2hqs/1/这就是我现在所拥有的:<template> <div> <table> <tbody> <tr v-for="row in this.content"> <td>{{row}}</td> </tr> </tbody> </table> <div></template><script> export default { data() { return { content: [] } }, created() { Event.$on("document-was-processed", content => { this.content = content; }); } }</script>现在上面只是打印出实际的 JSON 字符串。任何人都可以帮助我了解如何实际解析内容吗?
1 回答
- 1 回答
- 0 关注
- 287 浏览
添加回答
举报
0/150
提交
取消