|
8 | 8 | "Vue3 setup in tag": { |
9 | 9 | "scope": "vue", |
10 | 10 | "prefix": ["v3-setup"], |
11 | | - "body": ["<script setup>", "import { ref, reactive, toRefs, onMounted, onUnmounted, watch } from 'vue'", "$0", "</script>\r\n", "<template>\r\n", "</template>\r\n", "<style lang=\"css\" scoped>\r\n", "</style>"], |
| 11 | + "body": [ |
| 12 | + "<script setup>", |
| 13 | + "import { ref, reactive, computed, watch, toRefs, onMounted, onUnmounted } from 'vue'", |
| 14 | + "import { RouterLink, useRouter, useRoute } from 'vue-router'", |
| 15 | + "import { useAuthStore } from '../stores/auth.js'", |
| 16 | + "import { useI18n } from 'vue-i18n'", |
| 17 | + "const { t, locale, availableLocales } = useI18n({ useScope: 'global' })", |
| 18 | + "const emits = defineEmits(['update:modelValue', 'change'])", |
| 19 | + "const props = defineProps({ label: { type: String, required: true, default: 'Label' }, })", |
| 20 | + "const store = useAuthStore()", |
| 21 | + "const route = useRoute()", |
| 22 | + "let input = ref(null)", |
| 23 | + "let password = ref('')", |
| 24 | + "const checked = computed(() => { return props.modelValue + 1 })", |
| 25 | + "onMounted(() => {", |
| 26 | + "input.value.focus()", |
| 27 | + "console.log('Current locale', locale.value, availableLocales)", |
| 28 | + "store.changeLocale(route.query.locale)", |
| 29 | + "store.activateUser(route.params.id, route.params.code)", |
| 30 | + "})", |
| 31 | + "function onSubmit(e) {", |
| 32 | + " store.scrollTop()", |
| 33 | + " store.loginUser(new FormData(e.target))", |
| 34 | + "}", |
| 35 | + "watch(() => locale.value, (lang) => { store.changeLocale(lang) })", |
| 36 | + "</script>", |
| 37 | + "<template>", |
| 38 | + " <router-link to=\"/\"><img class=\"float-left auth-logo\" src=\"@/assets/images/auth-logo.png\" height=\"70\" /></router-link>", |
| 39 | + " <router-link to=\"/login\" class=\"link-left\">{{ $t('change_password.Have_an_account') }}</router-link>", |
| 40 | + "$0", |
| 41 | + "<form @submit.prevent=\"onSubmit\" class=\"form-auth\">", |
| 42 | + " <input ref=\"input\" v-model=\"password\" name=\"password\">", |
| 43 | + " <button class=\"button\" :title=\"$t('change_password.Change')\">{{ $t('change_password.Change') }}</button>", |
| 44 | + "</form>", |
| 45 | + "</template>", |
| 46 | + "<style>", |
| 47 | + "@import './css/root.css';", |
| 48 | + "[color-scheme='dark'] {", |
| 49 | + " color-scheme: dark;", |
| 50 | + " --logo: url('@/assets/images/auth-logo-dark.png');", |
| 51 | + "}", |
| 52 | + "</style>", |
| 53 | + "<style lang=\"css\" scoped>", |
| 54 | + "@import './css/auth.css'", |
| 55 | + "</style>" |
| 56 | + ], |
12 | 57 | "description": "Vue3 setup in tag" |
13 | 58 | }, |
14 | 59 | "Php if": { |
|
0 commit comments