Ts assets module fix
This commit is contained in:
parent
57c690631d
commit
7fe39d4e52
3 changed files with 8 additions and 6 deletions
6
resources/ts/index.d.ts
vendored
6
resources/ts/index.d.ts
vendored
|
|
@ -1,6 +1,6 @@
|
|||
export {};
|
||||
import { AxiosStatic } from "axios";
|
||||
export { };
|
||||
import type VueTagsInput from "@sipec/vue3-tags-input";
|
||||
import { AxiosStatic } from "axios";
|
||||
|
||||
// * Enum
|
||||
interface EnumInterface {
|
||||
|
|
@ -75,7 +75,7 @@ declare global {
|
|||
Swal: Function;
|
||||
vueDebug: boolean | undefined;
|
||||
__SYSTEM: {
|
||||
_asset: string;
|
||||
_asset: Record<string, string>;
|
||||
_locale: string;
|
||||
_routes: Record<string, string>;
|
||||
_translations: {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
export default {
|
||||
methods: {
|
||||
asset(path: string) {
|
||||
return `${window.__SYSTEM._asset}${path}`;
|
||||
return `${window.__SYSTEM._asset[path] ?? path}`;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
<script @if(isset($nonce)) nonce="{{ $nonce }}" @endif>
|
||||
<script @if (isset($nonce)) nonce="{{ $nonce }}" @endif>
|
||||
if (!window.__SYSTEM) {
|
||||
window.__SYSTEM = {};
|
||||
}
|
||||
window.__SYSTEM._locale = '{{ app()->getLocale() }}';
|
||||
window.__SYSTEM._translations = @json(cache(sprintf('translations.%s', app()->getLocale())) ?? []);
|
||||
window.__SYSTEM._asset = '{{ asset('') }}';
|
||||
if (!window.__SYSTEM._asset) {
|
||||
window.__SYSTEM._asset = {};
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue