<template lang="pug">
div.breadcrumbs
router-link(
v-for="link, i in breadcrumbsLinks"
:key="i"
:to="link"
).breadcrumps__level {{link.meta.title}}
</template>
<script>
export default {
name: 'breadcrumbs',
computed: {
breadcrumbsLinks () {
let tmp = []
if (this.$route.matched) {
this.$route.matched.forEach(link => {
tmp.push(Object.assign({meta: {title: 'Title not found in meta'}}, link))
})
}
if (tmp.length === 0) {
tmp.push({path: '/', meta: {title: 'Home'}})
}
return tmp
}
}
}
</script>
const { data } = await HTTP.get('posts');
async function _getPostById(id) {
const post = await HTTP.get(`posts/${id}`)
return post
}
const _getPostById = id => HTTP.get(`posts/${id}`);
<span id="typed"></span>
<div id="actions">
<button data-action="start">play</button>
<button data-action="stop">pause</button>
</div>
const typed = new Typed('#typed', {
typeSpeed: 100,
loop: true,
strings: [
'hello, world!!',
'fuck the world',
'fuck everything',
],
});
document.querySelector('#actions').addEventListener('click', e => {
const { action } = e.target.dataset;
if (action) {
typed[action]();
}
});
var keys = Object.keys(arCartElements);
keys.forEach(function(elementId) {
var element = arCartElements[elementId];
console.log(element);
});
document.getElementById('virtuemart_country_id').onchange = function(e)
{
...
}
// call sortFunc([], elem.getAttribute('name'))
function sortFunc(data, key) {
return [...data].sort((a, b) => compare(parse(a[key]), parse(b[key])));
}
function parse(val) {
return isNaN(Number(val)) ? val : Number(val);
}
function compare(a, b) {
if(a > b) return 1;
if(a < b) return -1;
return 0;
}
var str = 'chupacabra';
function reverse(str) {
if (str.length === 0) return '';
var
s1 = str[0],
s = str.slice(1, str.length - 1),
s2 = str[str.length - 1]
return s2 + reverse(s) + s1
}
console.log(reverse(str))