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 A = 1 | |
let B = 2 | |
let C | |
function update() { | |
C = A + B | |
} |
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 A = 1 | |
let B = 2 | |
let C | |
C = A + B | |
console.log(C) // 3 | |
A = 2 | |
console.log(C) // still 3 |
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 { theProfile } from './theProfile.js'; | |
export default { | |
namespaced: true, | |
state: { | |
user: [] | |
}, | |
actions: { | |
recommendCourses() { | |
const theProfileStore = theProfile(); |
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
// store/modules/theProfile.js | |
export default { | |
namespaced: true, | |
state: { | |
user: [] | |
} | |
... | |
}; | |
// store/modules/theCours.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
const userStore = defineStore("userStore", { | |
state: () => { | |
return { | |
user: [], | |
}; | |
}, | |
actions: { | |
getNewUser() { | |
fetch('https://randomuser.me/api/') | |
.then((response) => { |
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
const store = createStore({ | |
state: { | |
user: [] | |
}, | |
mutations: { | |
changeUser (state, newUser) { | |
state.user = newUser; | |
} | |
}, | |
actions: { |
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
<select @change="parseItemsPerPage" v-model="itemsPerPage" name="dog-names" id="item-per-page"> | |
<option value="1">1</option> | |
<option value="3">3</option> | |
<option value="5">5</option> | |
<option value="10">10</option> | |
</select> |
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
<div class="btn-group"> | |
<button | |
v-for="pageNumber in totalPages" | |
@click="changeCurrentPage(pageNumber)" | |
> | |
{{ pageNumber }} | |
</button> | |
</div> |
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
<ul> | |
<li v-for="(city, id) in currentContents" :key="id"> | |
{{ city.name }} | |
</li> | |
</ul> |
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
computed: { | |
totalPages() { | |
return Math.ceil(this.dataAmount / this.itemsPerPage); | |
}, | |
currentContents() { | |
if (!this.cities || this.cities.length != this.cities.length) { | |
return; | |
} | |
this.dataAmount = this.cities.length; |