Elad Silberring
Python Web developer,. As a hobby I develop html 5 2D games
Lets move to Vuejs!
ELAD SILBERRING
VS
WHY VUE?
WHY NOT?
loading a json file with 10,000 items and rendering them with a card UI from the material css framework
<main>
<div class="thing">
<p>Some content here</p>
</div>
</main>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
//some jquery code here
</script>
<main>
<div class="thing">
<p>Some content here</p>
</div>
</main>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.3/vue.min.js"></script>
<script>
//some vue code here
</script>
<div id="output"></div>
<button id="increment">Increment</button>
<script>
var counter = 0;
$(document).ready(function() {
var $output = $('#output');
$('#increment').click(function() {
counter++;
$output.html(counter);
});
$output.html(counter);
});
</script>
<div id="app">
<div>{{ counter }}</div>
<button v-on:click="increment">Increment</button>
</div>
<script>
new Vue({
el: '#app',
data: {
counter: 0
},
methods: {
increment() {
this.counter++;
}
}
});
</script>
Jquery we're asking the DOM for information
Vue v-if vs v-show
Jquery event.preventDefault() and .done()
By Elad Silberring
Python Web developer,. As a hobby I develop html 5 2D games