@@ -17,25 +17,26 @@ app.use(i18n)
1717app . use ( stores )
1818app . use ( router )
1919
20- // // Glogals provide/inject composition api
21- // app.provide('globalStore', {
22- // id: 1,
23- // async getUsers() {
24- // let res = await axios.get('https://jsonplaceholder.typicode.com/users')
25- // console.log('App global store', res.data)
26- // },
27- // })
28-
29- // // v-color="'red'"
30- // app.directive('color', (el, binding) => {
31- // el.style.color = binding.value
32- // })
33-
34- // // v-highlight="'yellow'"
35- // app.directive('highlight', {
36- // mounted(el, binding, vnode) {
37- // el.style.background = binding.value
38- // },
39- // })
20+ /*
21+
22+ // Glogal provide/inject composition api
23+ app.provide('globalStore', {
24+ user: null,
25+ isLogged: false,
26+ async getUser(id = 1) {
27+ let res = await axios.get(`https://jsonplaceholder.typicode.com/users/${id}`)
28+ console.log('App global store', res.data)
29+ return res.data ?? null
30+ },
31+ })
32+
33+ // Directive v-highlight="'yellow'"
34+ app.directive('highlight', {
35+ mounted(el, binding, vnode) {
36+ el.style.background = binding.value
37+ },
38+ })
39+
40+ */
4041
4142app . mount ( '#app' )
0 commit comments