<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id="app">
<ul>
<li v-for="item in list">
<a v-bind:href="item.value">{{item.label}}</a>
</li>
</ul>
{{tree}}
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.3/vue.js"></script>
</body>
</html>
new Vue({
el:'#app',
data:{
list:[
{
"label":"Parks & Gardens",
"type":"place",
"value":"parks-gardens",
"id":"0CNYF4qh0aaYi2XLGCfG"
},
{
"label":" Art & Craft",
"type":"product",
"value":"art-craft",
"id":"4TfXwraLAJX9K5WeIBT5"
},
{
"label":"Monuments",
"type":"place",
"value":"monuments",
"id":"4mVxy4QEplxTnf6NwpIf"
},
{
"label":"Books",
"type":"book",
"value":"books",
"id":"4oVqbEDhPSYqaTDn4xMV"
},
{
"label":"Sports Academies",
"type":"place",
"value":"sports-academies",
"id":"H7GkAF0Hfdu3OoHBYyQY"
},
{
"label":"Store",
"type":"place",
"value":"store",
"id":"Ki4YjRNe4HmZWOCOpg9K"
},
{
"label":"Tennis Academies",
"parent":"sports-academies",
"type":"place",
"value":"tennis-academies",
"id":"N89adEZwHfSGMQiq1R5f"
},
{
"label":"Toy Stores",
"type":"place",
"parent":"stores",
"value":"toy-stores",
"id":"Oj6QgO0S0Z6AFHvrr2ZH"
},
{
"label":"Electronics",
"type":"product",
"value":"electronics",
"id":"UuztFKZrsw3vcciKaj8k"
},
{
"label":"Tech",
"type":"product",
"value":"tech",
"id":"WuqiVSXxmlCCQ5usAUNZ"
},
{
"label":"Book Stores",
"type":"place",
"parent":"stores",
"value":"book-stores",
"id":"ZmXlJ12jJROGeHjYcwOT"
},
{
"label":" Online Stores",
"type":"commerce",
"value":"online-stores",
"id":"cIRSVPcqSDr6WfuRe4OX"
},
{
"label":"Play Areas",
"type":"place",
"value":"play-areas",
"id":"fEk3dcKprq9Hd8rSgiG3"
},
{
"label":"Toys",
"type":"product",
"value":"toys",
"id":"rJTpw2V9apxe9jQjLTOS"
},
{
"label":"Stores",
"type":"place",
"value":"stores",
"id":"ZmXlJ12jJROGeHjYcwOH"
}
]
},
computed: {
newitem: function () {
return this.list.reduce(function(p,c) {
p[c.value] = c;
c.children = [];
return p;
}, {});
},
tree: function () {
return this.list.reduce(function(p,c) {
if (c.parent = 'undefined') {
p = c;
} else {
newitem[c.parent].children.push(c);
}
return p;
}, {});
}
}
});
Output
300px
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |