<script setup>
import { useRouter } from 'vue-router';
import { computed, watch } from 'vue';
import { useAuthStore } from '@/stores/auth'; // Пример с Pinia
const router = useRouter();
const authStore = useAuthStore();
const userRole = computed(() => authStore.role);
watch(userRole, (newRole) => {
if (newRole !== 'admin') {
router.push('/');
}
});
</script>
router.beforeEach((to, from, next) => {
const hasAccess = checkUserAccess(to);
if (!hasAccess) {
next('/');
} else {
next();
}
});
router.beforeEach((to, from, next) => {
const auth = getAuth()
auth.onAuthStateChanged(user => {
if (!user && to.path !== '/auth') {
next('/auth')
}
else if (user && to.path === '/auth') {
next(from.path)
}
next()
})
})
<FormKit v-for="(deadline_type, idx) in data.deadline_types" key="deadline_type.id"
type="date"
v-model="form[idx]deadline_type.code"
:label="deadline_type.name"
/>
<input :value="text" @input="addCurrentValue"/>
export default {
name: 'AuthCallback',
data() {
return {
accessToken: {},
}
},
mounted() {
const tokenParseRegex: RegExp = /access_token=(.*?)&/;
const idParseRegex: RegExp = /user_id(.*?)/;
const exAccessToken: RegExpMatchArray | null = useRoute().hash.match(tokenParseRegex);
this.accessToken = exAccessToken![1]
}
}
minContainerWidth
Type: Number
Default: 200
The minimum width of the container.
minContainerHeight
Type: Number
Default: 100
The minimum height of the container.
minCanvasWidth
Type: Number
Default: 0
The minimum width of the canvas (image wrapper).
minCanvasHeight
Type: Number
Default: 0
The minimum height of the canvas (image wrapper).
minCropBoxWidth
Type: Number
Default: 0
The minimum width of the crop box.
Note: This size is relative to the page, not the image.
minCropBoxHeight
Type: Number
Default: 0
The minimum height of the crop box.
Note: This size is relative to the page, not the image.
<component
v-if="headCell?.decorator?.name"
:is="headCell.decorator.name +'Cell'"
:row="row"
@decorator="handlerEmit"
/>
v-if="headCell?.decorator?.name"
- такое условие в template не отрабатывает ведь, тебе надо его через computed