Files
westone-ui/loginv2/index.html
2024-08-12 08:42:51 +07:00

140 lines
4.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WESTONE</title>
<!-- Vuetify CSS -->
<link href="../css/vuetify.css" rel="stylesheet" />
<!-- Local Stylesheet for Fonts -->
<link rel="stylesheet" href="../css/styles.css" />
<link href="../css/materialdesignicon.css" rel="stylesheet" />
</head>
<body>
<div id="app"></div>
<!-- Vue.js -->
<script src="../libraries/vue3.4.36.global.prod.js"></script>
<!-- Vuex -->
<script src="../libraries/vuex.js"></script>
<!-- Vuetify -->
<script src="../libraries/vuetify3.js"></script>
<!-- vue-i18n -->
<script src="../libraries/vue-i18n.global.js"></script>
<!-- Axios -->
<script src="../libraries/axios.js"></script>
<!-- Store JS -->
<script src="store/store.js"></script>
<!-- Component JS -->
<script src="components/ComponentA.js"></script>
<script src="components/ComponentB.js"></script>
<!-- <script src="https://unpkg.com/vue3-sfc-loader/dist/vue3-sfc-loader.iife.js"></script> -->
<script src="../libraries/vue3-sfc-loader.js"></script>
<script>
const { loadModule } = window["vue3-sfc-loader"];
const options = {
moduleCache: {
vue: Vue,
},
getFile(url) {
return fetch(url).then((response) =>
response.ok ? response.text() : Promise.reject(response)
);
},
addStyle(textContent) {
const style = document.createElement("style");
style.textContent = textContent;
const ref = document.head.getElementsByTagName("style")[0] || null;
document.head.insertBefore(style, ref);
},
};
// Locale messages
const messages = {
en: {
message: {
login: "Login",
email: "Email",
password: "Password",
forgotPassword: "Forgot password?",
placeholderEmail: "Enter your email",
placeholderPassword: "Enter your password",
},
},
id: {
message: {
login: "Masuk",
email: "Surel",
password: "Kata Sandi",
forgotPassword: "Lupa kata sandi?",
placeholderEmail: "Isikan email anda",
placeholderPassword: "Isikan kata sandi anda",
},
},
};
// Get the browser's preferred language
const browserLocale = navigator.language || navigator.languages[0];
// Initialize vue-i18n
const i18n = VueI18n.createI18n({
locale: browserLocale.startsWith("id") ? "id" : "en", // Set locale based on browser setting
fallbackLocale: "en", // Set fallback locale
messages, // Set locale messages
});
// Vue App
const app = Vue.createApp({
components: {
"component-a": ComponentA,
"component-b": ComponentB,
},
data() {
return {
visible: false,
bg_src: "./images/bg_cover.svg",
items: [
{
src: "./images/frame_1.svg",
},
{
src: "./images/frame_1.svg",
},
],
loading: false, // Initialize loading state
};
},
template: `
<v-row no-gutters>
<v-col cols="8">
<hello-world></hello-world>
</v-col>
<v-col cols="4">
<div class="d-flex justify-center mb-6 mt-4 bg-surface-variant">
<v-img
class="bg-white"
height="86px"
src="./images/logo.svg"
></v-img>
</div>
</v-col>
</v-row>
`,
});
const vuetify = Vuetify.createVuetify();
app.use(store);
app.use(vuetify);
app.use(i18n);
loadModule("./components/coba.vue", options).then((component) => {
app.component("hello-world", component);
app.mount("#app");
});
</script>
</body>
</html>