This file contains hidden or 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
<template> | |
<div id="tabs" class="container"> | |
<div class="tabs"> | |
<a v-on:click="activetab=1" v-bind:class="[ activetab === 1 ? 'active' : '' ]">Tab 1</a> | |
<a v-on:click="activetab=2" v-bind:class="[ activetab === 2 ? 'active' : '' ]">Tab 2</a> | |
<a v-on:click="activetab=3" v-bind:class="[ activetab === 3 ? 'active' : '' ]">Tab 3</a> | |
</div> | |
<div class="content"> |
This file contains hidden or 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 path = require("path"); | |
const { JSONAdapter } = require("vue-translation-manager"); | |
module.exports = { | |
srcPath: path.join(__dirname, "src/"), | |
adapter: new JSONAdapter({ | |
path: path.join(__dirname, "src/locales/"), | |
}), | |
languages: ["ko", "en", "es", "ja", "zh"], | |
}; |
This file contains hidden or 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 Vue from "vue"; | |
import VueI18n from "vue-i18n"; | |
Vue.use(VueI18n); | |
// On change of language, switch the /locals/_language_.json file | |
function loadLocaleMessages() { | |
const locales = require.context( | |
"./locales", | |
true, |
This file contains hidden or 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 { createApp } from 'vue' | |
import App from './App.vue' | |
// i18n | |
import I18n from './i18n.js' | |
const i18n = createI18n({ | |
locale: | |
localStorage.getItem('lang') || | |
// Detect user's browser language |
This file contains hidden or 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
// In App.vue | |
watch: { | |
$route() { | |
window.scrollTo(0, 0) | |
} | |
}, |
This file contains hidden or 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
async mounted() { | |
// Detect if user is on Desktop or Mobile platform, then save to store | |
this.$isMobile() | |
? this.$store.commit('setPlatform', 'mobile') | |
: this.$store.commit('setPlatform', 'desktop') | |
}, |
This file contains hidden or 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 store from '../store' <-- To access your Vuex store | |
import Vue from 'vue' // <-- used for vue-toastification | |
class Utils { | |
// Copy a string to user's clipboard | |
copyToClipboard(text) { | |
let copyText = document.createElement('input') | |
document.body.appendChild(copyText) | |
copyText.value = text | |
copyText.select() |
This file contains hidden or 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
// In parent | |
data() { | |
return { | |
message: 'This is my message' | |
} | |
} | |
// In child template | |
<div>{{ $parent.message }}</div> // <-- results in 'This is my message' |
This file contains hidden or 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
v-for="(route, idx) in $router.options.routes.filter( | |
(routeItem) => routeItem.name === $route.matched[0].name | |
)" |
OlderNewer