Vue
by khamer
HTML
<script src="https://unpkg.com/[email protected]/lib/Clockvine.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vuex/3.1.3/vuex.min.js"></script>
<div id="app">
<spells v-slot="stuff">
<div>{{ stuff }}</div>
</spells>
</div>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
li {
margin: 8px 0;
}
h2 {
font-weight: bold;
margin-bottom: 15px;
}
del {
color: rgba(0, 0, 0, 0.3);
}
Vue
Vue.use(Vuex);
const store = new Vuex.Store({
modules: {
spells: new Clockvine.ApiModule('https://www.dnd5eapi.co/api/spells/'),
}
})
new Vue({
el: "#app",
store,
components: {
spells: Clockvine.CollectionComponent.for('spells'),
},
});