View imageUpload.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<input type="file" @change="avatarChange" class="uploadIcon"> | |
</div> | |
</template> | |
<script> | |
export default { |
View ref.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<p>Reference Number: {{referenceNumber}} | |
</div> | |
</template> | |
<script> | |
export default { | |
data: function () { | |
return { |
View longpress.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let pressTimer = null; | |
View longpress-final.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define variable | |
let pressTimer = null; | |
// Create timeout ( run function after 1s ) | |
let start = (e) => { | |
if (e.type === 'click' && e.button !== 0) { | |
return; | |
} |
View longpress-cancel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cancel = (e) => { | |
// Check if timer has a value or not | |
if (pressTimer !== null) { | |
clearTimeout(pressTimer) | |
pressTimer = null | |
} | |
} |
View longpress-start.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create timeout ( run function after 1s ) | |
let start = (e) => { | |
// Make sure the event trigger isn't a click event | |
if (e.type === 'click' && e.button !== 0) { | |
return; | |
} | |
// Make sure we don't currently have a setTimeout running | |
// before starting another | |
if (pressTimer === null) { |
View store.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import Vue | |
import Vue from 'vue'; | |
// import Vuex | |
import Vuex from 'vuex'; | |
// Install the Vuex plugin on vue | |
Vue.use(Vuex); | |
// create a Vuex store instance | |
export const store = new Vuex.Store({ |
View store.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import Vue | |
import Vue from 'vue'; | |
// import Vuex | |
import Vuex from 'vuex'; | |
// Install the Vuex plugin on vue | |
Vue.use(Vuex); | |
// create a Vuex store instance | |
export const store = new Vuex.Store({ |
View example3.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<main> | |
<h1>Cart Content</h1> | |
<p>Total Number of Items: {{totalNumberOfCartItems}}</p> | |
</main> | |
</template> | |
<script> | |
export default { | |
computed: { |
View main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue'; | |
import store from './store.js'; | |
new Vue({ | |
// Adding the Vuex store to the Vue instance | |
store, | |
}).$mount('#app'); | |
OlderNewer