page: 📄 超过一定大小禁止缩放
This commit is contained in:
parent
dbd650d1ef
commit
010d9d8ea4
|
@ -1,8 +1,15 @@
|
|||
<template>
|
||||
<div class="container-fluid">
|
||||
<ul>
|
||||
<li v-for="(route, index) in pageRoutes" :key="index">
|
||||
<RouterLink :to="route.path">{{ `${route.path}【${String(route.name)}】` }}</RouterLink>
|
||||
<li v-for="(route, index) in routes" :key="index">
|
||||
<h5>{{ route.title }}</h5>
|
||||
<ul>
|
||||
<li v-for="child in route.children" :key="child.path">
|
||||
<RouterLink :to="child.path">
|
||||
{{ `${child.path}【${String(child.name)}】` }}
|
||||
</RouterLink>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -12,6 +19,32 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { pageRoutes } from '@/router/module/pageRoutes';
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
const routes = ref<any>([]);
|
||||
|
||||
/**
|
||||
* * 获取路由数据
|
||||
*/
|
||||
const getRouteList = () => {
|
||||
const routesTree = pageRoutes.reduce((acc, route) => {
|
||||
const title = route.path.split('/')[1];
|
||||
const formatRoute = { name: route.name, path: route.path };
|
||||
|
||||
if (acc[title]) {
|
||||
acc[title].children.push(formatRoute);
|
||||
} else {
|
||||
acc[title] = { title, children: [formatRoute] };
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
routes.value = Object.values(routesTree);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getRouteList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<script setup lang="ts">
|
||||
import { useWindowSize } from '@vueuse/core';
|
||||
import { onMounted } from 'vue';
|
||||
import Konva from 'konva/lib';
|
||||
|
||||
const { width, height } = useWindowSize();
|
||||
|
||||
const initial = () => {
|
||||
const stage = new Konva.Stage({ container: 'container', width: width.value, height: height.value });
|
||||
const layer = new Konva.Layer();
|
||||
stage.add(layer);
|
||||
|
||||
const rect = new Konva.Rect({
|
||||
x: 100,
|
||||
y: 100,
|
||||
width: 100,
|
||||
height: 100,
|
||||
fill: 'red',
|
||||
name: 'rect',
|
||||
stroke: 'black',
|
||||
strokeWidth: 6,
|
||||
draggable: true,
|
||||
});
|
||||
layer.add(rect);
|
||||
|
||||
const tr = new Konva.Transformer();
|
||||
layer.add(tr);
|
||||
|
||||
tr.nodes([rect]);
|
||||
tr.on('transform', function () {
|
||||
const width = rect.width() * rect.scaleX();
|
||||
if (width > 200) {
|
||||
tr.stopTransform();
|
||||
|
||||
const scaleX = 200 / rect.width();
|
||||
rect.scaleX(scaleX);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => initial());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="container"></div>
|
||||
</template>
|
Loading…
Reference in New Issue