Skip to content

Commit d0b89a5

Browse files
authored
Update
1 parent b31aa80 commit d0b89a5

File tree

8 files changed

+32
-24
lines changed

8 files changed

+32
-24
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Vue 3 in Laravel 10
22

3-
Minimal Vue 3 application with router, i18n, pinia stores and @googlemaps/js-api-loader.
3+
Minimal Vue 3 application with router, i18n, pinia store.
44

55
## Install package
66

app/jsconfig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"compilerOptions": {
3+
"allowJs": true
4+
}
5+
}

app/resources/js/app.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,26 @@ app.use(i18n)
1717
app.use(stores)
1818
app.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

4142
app.mount('#app')

app/resources/js/components/ChangeLocale.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010
import { watch, computed, onMounted } from 'vue'
1111
import { useI18n } from 'vue-i18n'
1212
// import { useAuthStore } from '@/views/page/auth/stores/auth.js'
13-
1413
// const store = useAuthStore()
1514
const { t, locale, availableLocales } = useI18n({ useScope: 'global' })
1615
1716
onMounted(() => {
18-
console.log('Current locale', locale.value, availableLocales)
17+
// console.log('Current locale', locale.value, availableLocales)
1918
})
2019
2120
watch(
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<template>
22
<h1>404 {{ $t('error404.title') }}</h1>
33
</template>
4+
<script setup></script>

app/resources/views/vue.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta charset="utf-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<title>{{ __('Welcome') }}</title>
8+
89
{{--
910
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous" referrerpolicy="no-referrer" />
1011
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" integrity="sha512-c42qTSw/wPZ3/5LBzD+Bw5f7bSF2oxou6wEb+I/lqeaKV5FDIfMvvRp772y4jcJLKuGUOpbJMdg/BTl50fJYAw==" crossorigin="anonymous" referrerpolicy="no-referrer" />

app/routes/web.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
return view('welcome');
1919
});
2020

21-
// Vue
21+
// Vue catch all
2222
Route::fallback(function () {
2323
return view('vue');
2424
});

src/VueServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function boot()
2828
__DIR__ . '/../app/routes' => base_path('routes'),
2929
__DIR__ . '/../app/package.json' => base_path('package.json'),
3030
__DIR__ . '/../app/vite.config.js' => base_path('vite.config.js'),
31+
__DIR__ . '/../app/jsconfig.json' => base_path('jsconfig.json'),
3132
], 'vue-config');
3233
}
3334
}

0 commit comments

Comments
 (0)