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
// 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
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
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
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
whenDepsChange(update) |
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 myFriendList = { | |
list: ["Pauline", "Ségoline", "Christina"], | |
get lastNewFriend() { | |
return this.list[this.list.length - 1] | |
}, | |
set addNewFriend(newFriend) { | |
this.list.push(newFriend) | |
} | |
} |
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
myFriendList.list.push("Rosalie") |
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 myName = ref('Cassie') | |
myName.value = 'Vanessa' |
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 target = { | |
message1: "hello", | |
message2: "everyone" | |
}; | |
const handler = { | |
get(target, prop, receiver) { | |
return "world"; | |
} | |
}; |