// 1. Define route components.
// These can be imported from other files
const Foo = {
template: `<div>
<h3 class="text-center">Welcome Heptagon Coin market place</h3>
</div>`
}
const Bar = { template: '<div>bar</div>' }
let coin = Vue.component('coin-componentr', {
data: function () {
return {
title: 'New Title',
coinList: []
}
},
mounted () {
axios
.get('https://api.coinmarketcap.com/v2/listings/')
.then(response => (this.coinList = response.data.data))
},
template: `
<div>
<h3 class="text-center">Coins you can trade here</h3>
<ol class="list">
<li class="list-item" v-for="(coin, index) in coinList"><router-link to="/foo">
{{coin.name}}{{coin.symbol}}
</router-link>
</li>
</ul>
</div>
`
})
// 2. Define some routes
// Each route should map to a component. The "component" can
// either be an actual component constructor created via
// `Vue.extend()`, or just a component options object.
// We'll talk about nested routes later.
const routes = [
{ path: '/foo', component: Foo },
{ path: '/bar', component: coin }
]
// 3. Create the router instance and pass the `routes` option
// You can pass in additional options here, but let's
// keep it simple for now.
const router = new VueRouter({
routes // short for `routes: routes`
})
const vueObject = {
el: '#vue',
router,
data: {
appTitle: 'Vue Application',
}
}
var vm = new Vue(
vueObject
);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.