<div id="app" @click="onClick">
...
new Vue({
el: '#app',
methods: {
onClick(e) {
if (e.target.tagName === 'A') {
e.preventDefault();
window.open(e.target.getAttribute('href'));
}
},
...
},
...
});
$(document).ready(function(){
$('#content a').attr('target', '_blank');
});
window.onload = function(){
var anchors = document.getElementById('content').getElementsByTagName('a');
for (var i=0; i<anchors.length; i++){
anchors[i].setAttribute('target', '_blank');
}
}
$('#content a').each(function() {
var linky = new RegExp('/' + window.location.host + '/');
if (!linky.test(this.href)) {
$(this).attr("target","_blank");
}
});
<div id="app">
<h1>{{ h() }}</h1>
</div>
new Vue({
el: '#app',
methods: {
h() {
return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
},
},
created() {
window.addEventListener('resize', () => this.$forceUpdate());
},
});
window.scrollTo(0,parseInt(document.body.style.top));
if (!this.isActive) {
document.body.style.removeProperty('position')
window.scrollTo(0,parseInt(document.body.style.top));
} else {
document.body.addEventListener('touchmove', function(e) {
e.preventDefault();
});
data: () => ({
showChars: 0,
...
}),
computed: {
typedString() {
return this.string.slice(0, this.showChars);
},
},
<h2>{{ typedString }}</h2>
mounted() {
const intervalID = setInterval(() => {
if (++this.showChars === this.string.length) {
clearInterval(intervalID);
}
}, 50);
},