@shijiu/jsview-vue-samples 1.9.747
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AnimPicture/App.vue +207 -0
- package/AnimPicture/assets/animated_webp.webp +0 -0
- package/AnimPicture/assets/ball_3.webp +0 -0
- package/AnimPicture/assets/girl_run.gif +0 -0
- package/AnimPicture/assets/quan.webp +0 -0
- package/Basic/App.vue +134 -0
- package/Basic/assets/border.png +0 -0
- package/Basic/assets/border2.png +0 -0
- package/Basic/assets/icon.png +0 -0
- package/Basic/assets/test.jpg +0 -0
- package/Basic/components/ContentBlock.vue +38 -0
- package/Basic/components/FontStyle.css +16 -0
- package/Basic/components/anim/AnimGroup.vue +66 -0
- package/Basic/components/anim/AnimKeyframeBasic.vue +119 -0
- package/Basic/components/anim/AnimKeyframeComposite.vue +52 -0
- package/Basic/components/anim/AnimTransition.vue +157 -0
- package/Basic/components/div/DivBackground.vue +44 -0
- package/Basic/components/div/DivClip.vue +159 -0
- package/Basic/components/div/DivCssScoped.vue +20 -0
- package/Basic/components/div/DivCssVar.vue +53 -0
- package/Basic/components/div/DivGroup1.vue +47 -0
- package/Basic/components/div/DivGroup2.vue +65 -0
- package/Basic/components/div/DivLayout.vue +70 -0
- package/Basic/components/div/DivRadius.vue +65 -0
- package/Basic/components/div/DivTransform.vue +32 -0
- package/Basic/components/img/ImageGroup.vue +31 -0
- package/Basic/components/img/ImgLayout.vue +41 -0
- package/Basic/components/panel/Panel1.vue +55 -0
- package/Basic/components/panel/Panel2.vue +31 -0
- package/Basic/components/panel/TitleBar.vue +29 -0
- package/Basic/components/text/TextAlign.vue +66 -0
- package/Basic/components/text/TextEmoji.vue +26 -0
- package/Basic/components/text/TextFontStyle.vue +89 -0
- package/Basic/components/text/TextGroup1.vue +49 -0
- package/Basic/components/text/TextGroup2.vue +28 -0
- package/Basic/components/text/TextOverflow.vue +110 -0
- package/BasicFocusControl/App.vue +104 -0
- package/BasicFocusControl/components/BaseBlock.vue +50 -0
- package/BasicFocusControl/components/MainArea.vue +83 -0
- package/BasicFocusControl/components/MainAreaLeftBlock.vue +17 -0
- package/BasicFocusControl/components/MainAreaRightBlock.vue +27 -0
- package/BasicFocusControl/components/SideBar.vue +58 -0
- package/BasicFocusControl/components/SideBarBlock.vue +27 -0
- package/Collision/App.vue +452 -0
- package/ColorSpace/App.vue +126 -0
- package/ColorSpace/bmpDemo.bmp +0 -0
- package/ColorSpace/jpegDemo.jpeg +0 -0
- package/ColorSpace/pngDemo.png +0 -0
- package/ColorSpace/pngNoAlphaDemo.png +0 -0
- package/DemoHomepage/App.vue +27 -0
- package/DemoHomepage/components/BodyFrame.vue +95 -0
- package/DemoHomepage/components/Dialog.vue +94 -0
- package/DemoHomepage/components/Item.vue +77 -0
- package/DemoHomepage/components/TabFrame.vue +85 -0
- package/DemoHomepage/router.js +196 -0
- package/DemoHomepage/views/Homepage.vue +195 -0
- package/FilterDemo/AnimatePic.vue +58 -0
- package/FilterDemo/App.vue +159 -0
- package/FilterDemo/VideoLayer.vue +62 -0
- package/FilterDemo/jpegDemo.jpeg +0 -0
- package/FilterDemo/webpDemo.webp +0 -0
- package/FlipCard/App.vue +71 -0
- package/FlipCard/FlipCard.vue +118 -0
- package/FlipCard/assets/blue_egg.png +0 -0
- package/FlipCard/assets/red_egg.png +0 -0
- package/FlipCard/data.js +13 -0
- package/GridDemo/App.vue +215 -0
- package/GridDemo/ButtonBlock.vue +112 -0
- package/GridDemo/FocusItem.vue +37 -0
- package/GridDemo/Item.vue +93 -0
- package/HashHistory/App.vue +115 -0
- package/HashHistory/components/HorizontalButtonList.vue +91 -0
- package/HashHistory/components/Item.vue +60 -0
- package/HashHistory/router.js +41 -0
- package/HashHistory/views/MainPage.vue +57 -0
- package/HashHistory/views/SubPage.vue +66 -0
- package/ImpactStop/App.vue +435 -0
- package/Input/App.vue +164 -0
- package/Input/FullKeyboard.vue +87 -0
- package/Input/InputPanel.vue +131 -0
- package/Input/KeyboardItem.vue +58 -0
- package/LongImage/App.vue +80 -0
- package/LongImage/Button.vue +58 -0
- package/LongImage/ButtonItem.vue +44 -0
- package/LongImage/LongImageScroll.vue +92 -0
- package/LongImage/Scroll.vue +14 -0
- package/LongImage/assets/1280x7200.jpg +0 -0
- package/LongText/App.vue +96 -0
- package/LongText/Button.vue +51 -0
- package/LongText/ButtonItem.vue +44 -0
- package/LongText/LongTextScroll.vue +192 -0
- package/LongText/Scroll.vue +14 -0
- package/Marquee/App.vue +247 -0
- package/Marquee/longText.js +14 -0
- package/MaskClip/App.vue +122 -0
- package/MaskClip/images/mask-025/config.json +29 -0
- package/MaskClip/images/mask-025/res/1.png +0 -0
- package/MaskClip/images/mask-025/res/2.png +0 -0
- package/MaskClip/images/mask-025/res/3.png +0 -0
- package/MaskClip/images/mask-025/res/4.png +0 -0
- package/MaskClip/images/mask-025/res/icon.png +0 -0
- package/MaskClip/images/mask-025/res/stroke.png +0 -0
- package/MaskClip/images/php.jpg +0 -0
- package/MetroWidgetDemos/Advanced/App.vue +46 -0
- package/MetroWidgetDemos/Advanced/ButtonItem.vue +90 -0
- package/MetroWidgetDemos/Advanced/Buttons.vue +70 -0
- package/MetroWidgetDemos/Advanced/Mixed.vue +77 -0
- package/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
- package/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
- package/MetroWidgetDemos/Advanced/widgets/Widgets.vue +116 -0
- package/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- package/MetroWidgetDemos/Item.vue +85 -0
- package/MetroWidgetDemos/PerformanceTest/App.vue +210 -0
- package/MetroWidgetDemos/PerformanceTest/Item.vue +90 -0
- package/MetroWidgetDemos/PerformanceTest/assets/bg.jpg +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_content.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_left.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_mid.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_right.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/focus_border.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/holder_logo.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/jrbm.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/line_left.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/line_mid.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/line_right.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/loading.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/logo.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/mcjx.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/tao.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/tmall.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/border.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +386 -0
- package/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +129 -0
- package/MetroWidgetDemos/PerformanceTest/data.js +45 -0
- package/MetroWidgetDemos/PingPong/App.vue +135 -0
- package/MetroWidgetDemos/PingPong/AppPage.vue +73 -0
- package/MetroWidgetDemos/PingPong/AppTab.vue +62 -0
- package/MetroWidgetDemos/PingPong/TabItem.vue +84 -0
- package/MetroWidgetDemos/PingPong/ViewSwiper.vue +214 -0
- package/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +75 -0
- package/MetroWidgetDemos/Simple/App.vue +45 -0
- package/MetroWidgetDemos/Simple/RelativeTemplate.vue +111 -0
- package/MetroWidgetDemos/WidgetItem.vue +89 -0
- package/MetroWidgetDemos/data.js +205 -0
- package/NinePatchDemo/App.vue +145 -0
- package/NinePatchDemo/Item.vue +69 -0
- package/NinePatchDemo/assets/border.png +0 -0
- package/Preload/App.vue +135 -0
- package/Preload/Item.vue +32 -0
- package/Preload/data.js +23 -0
- package/Preload/images/awesomeface.png +0 -0
- package/Preload/images/cat.jpg +0 -0
- package/Preload/images/rank.png +0 -0
- package/Preload/images/rank_focus.png +0 -0
- package/Preload/images/rule.png +0 -0
- package/Preload/images/rule_focus.png +0 -0
- package/Preload/images/start.png +0 -0
- package/Preload/images/start_focus.png +0 -0
- package/QrcodeDemo/App.vue +68 -0
- package/ScaleDownNeon/App.vue +107 -0
- package/SoundPool/App.vue +134 -0
- package/SoundPool/bgmusic.mp3 +0 -0
- package/SoundPool/coin.mp3 +0 -0
- package/SoundPool/jump.mp3 +0 -0
- package/SoundPool/lose.mp3 +0 -0
- package/SoundPool/run.mp3 +0 -0
- package/SprayView/App.vue +272 -0
- package/SprayView/assets/snow.png +0 -0
- package/SpriteImage/App.vue +173 -0
- package/SpriteImage/images/cat_run.png +0 -0
- package/SpriteImage/images/egg_break.json +116 -0
- package/SpriteImage/images/egg_break.png +0 -0
- package/SpriteImage/images/sprite.png +0 -0
- package/TextBox/App.vue +91 -0
- package/TextBox/RenderCenter.vue +133 -0
- package/TextBox/RenderLeft.vue +138 -0
- package/TextBox/RenderOneLine.vue +101 -0
- package/TextBox/RenderRight.vue +131 -0
- package/TextShadowDemo/App.vue +91 -0
- package/TextureAnimation/App.vue +336 -0
- package/TextureAnimation/App2.vue +111 -0
- package/TextureAnimation/assets/blackWhiteGrid.png +0 -0
- package/TextureAnimation/assets/light.png +0 -0
- package/TextureAnimation/assets/light2.png +0 -0
- package/TextureAnimation/assets/mask.png +0 -0
- package/TextureAnimation/assets/php.jpg +0 -0
- package/TextureAnimation/assets/php2.png +0 -0
- package/TextureAnimation/assets/swipLight.png +0 -0
- package/TextureSize/App.vue +132 -0
- package/TextureSize/bmpDemo.bmp +0 -0
- package/TextureSize/jpegDemo.jpeg +0 -0
- package/TextureSize/jpgDemo.jpg +0 -0
- package/TextureSize/pngDemo.png +0 -0
- package/TextureSize/pngNoAlphaDemo.png +0 -0
- package/ThrowMoveDemo/AccelerateDemo.vue +116 -0
- package/ThrowMoveDemo/App.vue +114 -0
- package/ThrowMoveDemo/LRParabolicDemo.vue +115 -0
- package/ThrowMoveDemo/TargetDemo.vue +116 -0
- package/ThrowMoveDemo/UDParabolicDemo.vue +121 -0
- package/TouchSample/App.vue +136 -0
- package/TouchSample/Item.vue +103 -0
- package/TouchSample/MetroWidgetHorizontal.vue +144 -0
- package/TouchSample/MetroWidgetVertical.vue +144 -0
- package/TouchSample/TouchContainerHorizontal.vue +160 -0
- package/TouchSample/TouchContainerVertical.vue +160 -0
- package/TouchSample/data.js +81 -0
- package/TransitPage/App.vue +29 -0
- package/VideoDemo/App.vue +121 -0
- package/VideoDemo/components/Button.vue +58 -0
- package/VideoDemo/components/Controllor.vue +197 -0
- package/VideoDemo/components/VideoFrame.vue +140 -0
- package/VisibleSensorDemo/App.vue +234 -0
- package/package.json +17 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* 【界面概述】
|
|
3
|
+
* 展示MetroWidget控件的用法
|
|
4
|
+
*
|
|
5
|
+
* 【控件介绍】
|
|
6
|
+
* MetroWidget:
|
|
7
|
+
* top {int} 控件的y,默认为0
|
|
8
|
+
* left {int} 控件的x, 默认为0
|
|
9
|
+
* width {int} (必选)控件的宽
|
|
10
|
+
* height {int} (必选)控件的高
|
|
11
|
+
*
|
|
12
|
+
* name {string} (必选)用于设置焦点的名称
|
|
13
|
+
* padding {object} 控件内边距, 默认为{left: 0, right: 0, top: 0, bottom: 0}
|
|
14
|
+
* direction {enum} (必选)控件方向 HROIZONTAL/VERTICAL
|
|
15
|
+
* loopFocus {boolean} 焦点到边界后自动转到下一行,默认false
|
|
16
|
+
* initFocusId {int} 初始焦点,默认为0
|
|
17
|
+
* slideStyle {SlideStyle} 页面滑动类型 seamless/wholepage
|
|
18
|
+
* slideSpeed {float} 页面滑动速度,默认为1.5
|
|
19
|
+
* slideEasing {string} 页面滑动动画easing
|
|
20
|
+
|
|
21
|
+
* data {array} (必选)数据列表
|
|
22
|
+
* dispatcher {SWidgetDispatcher} 用于设置MetroWidget控件内部的状态,默认为null
|
|
23
|
+
* measures {function} (必选)返回item的模板信息的回调,
|
|
24
|
+
* @params item {object} data中的数据
|
|
25
|
+
* @return 模板信息,
|
|
26
|
+
{
|
|
27
|
+
width: item的宽,
|
|
28
|
+
height: item的高,
|
|
29
|
+
focusable: item是否可以获得焦点,
|
|
30
|
+
}
|
|
31
|
+
*
|
|
32
|
+
* onClick {function} item点击回调
|
|
33
|
+
* @params item data中的数据
|
|
34
|
+
* onFocus {function} 控件获取焦点的回调
|
|
35
|
+
* onBlur {function} 控件失去焦点的回调
|
|
36
|
+
* onEdge {function} 焦点移动到边缘时的回调
|
|
37
|
+
* @params {"direction": {EdgeDirection}边缘方向, "rect": 到达边缘时的区域{x: 0, y: 0, width: 0,height: 0}}
|
|
38
|
+
*
|
|
39
|
+
* enableTouch {boolean} 支持触控
|
|
40
|
+
* loadAll {boolean} 加载不显示的view,触控场景使用
|
|
41
|
+
*
|
|
42
|
+
* 【技巧说明】
|
|
43
|
+
* Q: 插槽props如何使用?
|
|
44
|
+
* A: data: 当前item的数据
|
|
45
|
+
* query: 获取一些额外信息的对象
|
|
46
|
+
{
|
|
47
|
+
id: {int} item的id,
|
|
48
|
+
position: {Function} 获取item坐标的函数
|
|
49
|
+
@params id {int} item的id
|
|
50
|
+
@return {object} item的位置 {xPos, yPos, width, height}
|
|
51
|
+
}
|
|
52
|
+
* onEdge: 若单元格内另有可接管按键的控件(如MetroWidget),该控件到达边缘需要通知MetroWidget时的回调
|
|
53
|
+
* onAction: 单元格内控件需要通过onAction.register方法向MetroWidget注册onFocus, onBlur, onClick
|
|
54
|
+
*
|
|
55
|
+
* Q: 如何进行布局,定制每个格的尺寸?
|
|
56
|
+
* A: 首先选定一个布局的方式,一列列地横向布局(HROIZONTAL)还是一行行地纵向(VERTICAL)布局,设置给属性direction
|
|
57
|
+
* 然后将单元格尺寸反馈器(函数)设置到measures中,进行布局时,组件会回调measures函数获得每个单元格的尺寸,
|
|
58
|
+
* 当一列放满单元格后(如果是纵向布局,则是一行放满后),自动换列去布局下一列。
|
|
59
|
+
*
|
|
60
|
+
* Q: 单元格的普通状态,焦点状态,失焦状态如何渲染?
|
|
61
|
+
* A: 在单元的控件中通过往onAction注册的onFocus,onBlur控制显示
|
|
62
|
+
*
|
|
63
|
+
* Q: 控件中的导航处理(上下左右,OK键)需要什么响应的开发?
|
|
64
|
+
* A: 上下左右键已经由控件接管,不需要开发者额外处理,上下左右键会触发翻页时间,翻页的形式由属性slideStyle来定制。
|
|
65
|
+
* 另外,通过OnClick属性可以注册按键回调函数,来处理用户的OK键动作。
|
|
66
|
+
*
|
|
67
|
+
* Q: 边缘格获取焦点放大后显示不全?
|
|
68
|
+
* A: 设置padding,注意item的排布范围是控件的宽高减去对应的padding
|
|
69
|
+
*
|
|
70
|
+
* Q: 焦点怎么移出控件?
|
|
71
|
+
* A: 当焦点移动到控件边缘时,会调用onEdge回调。在回调中通过参数传递的值来决定焦点转移的行为
|
|
72
|
+
-->
|
|
73
|
+
|
|
74
|
+
<script setup>
|
|
75
|
+
import { data1, data2, data3 } from "./data";
|
|
76
|
+
import borderImgPath from "./border.png";
|
|
77
|
+
import Item from "./components/ContentItem.vue";
|
|
78
|
+
import MyTab from "./components/MyTab.vue";
|
|
79
|
+
import { ref, shallowRef, onMounted, onBeforeUnmount } from "vue";
|
|
80
|
+
import { useRouter } from "vue-router";
|
|
81
|
+
import {
|
|
82
|
+
VERTICAL,
|
|
83
|
+
MetroWidget,
|
|
84
|
+
EdgeDirection,
|
|
85
|
+
jJsvRuntimeBridge,
|
|
86
|
+
useFocusHub,
|
|
87
|
+
} from "jsview";
|
|
88
|
+
|
|
89
|
+
const router = useRouter();
|
|
90
|
+
const focusHub = useFocusHub();
|
|
91
|
+
let contentData = data1;
|
|
92
|
+
let requestDataTime = 0;
|
|
93
|
+
const mwRef = shallowRef(null);
|
|
94
|
+
|
|
95
|
+
const onKeyDown = (ev) => {
|
|
96
|
+
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
97
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
98
|
+
router.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
return false;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const provideData = () => {
|
|
105
|
+
return contentData;
|
|
106
|
+
};
|
|
107
|
+
const measures = () => {
|
|
108
|
+
return {
|
|
109
|
+
width: 227,
|
|
110
|
+
height: 351,
|
|
111
|
+
focusable: true,
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
const onFocus = () => {
|
|
115
|
+
focusHub.setFocus("mw");
|
|
116
|
+
};
|
|
117
|
+
const onWidgetEdge = (edge) => {
|
|
118
|
+
if (edge.direction === EdgeDirection.top) {
|
|
119
|
+
focusHub.setFocus("tab");
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const onTabEdge = () => {
|
|
123
|
+
focusHub.setFocus("mw");
|
|
124
|
+
};
|
|
125
|
+
const onItemFocus = (id) => {
|
|
126
|
+
if (requestDataTime != 0) {
|
|
127
|
+
clearTimeout(requestDataTime);
|
|
128
|
+
requestDataTime = 0;
|
|
129
|
+
}
|
|
130
|
+
// requestDataTime = setTimeout(() => {
|
|
131
|
+
switch (id) {
|
|
132
|
+
case 0:
|
|
133
|
+
contentData = data1;
|
|
134
|
+
break;
|
|
135
|
+
case 1:
|
|
136
|
+
contentData = data2;
|
|
137
|
+
break;
|
|
138
|
+
case 2:
|
|
139
|
+
contentData = data3;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
mwRef.value?.refreshData(true);
|
|
143
|
+
// }, 0);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
onBeforeUnmount(() => {
|
|
147
|
+
if (requestDataTime != 0) {
|
|
148
|
+
clearTimeout(requestDataTime);
|
|
149
|
+
requestDataTime = 0;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
onMounted(() => {
|
|
154
|
+
jJsvRuntimeBridge.notifyPageLoaded();
|
|
155
|
+
});
|
|
156
|
+
</script>
|
|
157
|
+
|
|
158
|
+
<template>
|
|
159
|
+
<jsv-focus-block
|
|
160
|
+
ref="rootNode"
|
|
161
|
+
autoFocus
|
|
162
|
+
:onKeyDown="onKeyDown"
|
|
163
|
+
:onFocus="onFocus"
|
|
164
|
+
>
|
|
165
|
+
<div class="rootSize">
|
|
166
|
+
<div :style="{ left: 50, top: 50 }">
|
|
167
|
+
<my-tab name="tab" :onEdgeDown="onTabEdge" :onItemFocus="onItemFocus" />
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<div class="widgetPos">
|
|
171
|
+
<metro-widget
|
|
172
|
+
name="mw"
|
|
173
|
+
ref="mwRef"
|
|
174
|
+
:provideData="provideData"
|
|
175
|
+
:width="1253"
|
|
176
|
+
:height="600"
|
|
177
|
+
:padding="{ left: 26, top: 36, right: 26, bottom: 36 }"
|
|
178
|
+
:direction="VERTICAL"
|
|
179
|
+
:measures="measures"
|
|
180
|
+
:onEdge="onWidgetEdge"
|
|
181
|
+
>
|
|
182
|
+
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
183
|
+
<Item
|
|
184
|
+
:data="data"
|
|
185
|
+
:query="query"
|
|
186
|
+
:onEdge="onEdge"
|
|
187
|
+
:onAction="onAction"
|
|
188
|
+
/>
|
|
189
|
+
</template>
|
|
190
|
+
</metro-widget>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
</jsv-focus-block>
|
|
194
|
+
</template>
|
|
195
|
+
|
|
196
|
+
<style scoped>
|
|
197
|
+
.rootSize {
|
|
198
|
+
top: 0px;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.widgetPos {
|
|
202
|
+
top: 120;
|
|
203
|
+
left: 50;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.focusPos {
|
|
207
|
+
top: 10;
|
|
208
|
+
left: 10;
|
|
209
|
+
}
|
|
210
|
+
</style>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-07-11 18:03:22
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-07-11 18:03:23
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script>
|
|
9
|
+
export default {
|
|
10
|
+
props: {
|
|
11
|
+
data: Object,
|
|
12
|
+
query: Object,
|
|
13
|
+
onEdge: Function,
|
|
14
|
+
onAction: Object,
|
|
15
|
+
},
|
|
16
|
+
methods: {
|
|
17
|
+
onFocus() {
|
|
18
|
+
this.focus = true;
|
|
19
|
+
this.anim = "focusScale 0.3s";
|
|
20
|
+
},
|
|
21
|
+
onBlur() {
|
|
22
|
+
this.focus = false;
|
|
23
|
+
this.anim = "blurScale 0.3s";
|
|
24
|
+
},
|
|
25
|
+
onClick() {
|
|
26
|
+
console.log("item click");
|
|
27
|
+
},
|
|
28
|
+
getStyle() {
|
|
29
|
+
const width = this.focus
|
|
30
|
+
? (this.data.blocks.w - 10) * (1 / 0.8)
|
|
31
|
+
: this.data.blocks.w - 10;
|
|
32
|
+
const height = this.focus
|
|
33
|
+
? (this.data.blocks.h - 10) * (1 / 0.8)
|
|
34
|
+
: this.data.blocks.h - 10;
|
|
35
|
+
const posx = this.focus ? (this.data.blocks.w - 10 - width) / 2 : 0;
|
|
36
|
+
const posy = this.focus ? (this.data.blocks.h - 10 - height) / 2 : 0;
|
|
37
|
+
return {
|
|
38
|
+
left: posx,
|
|
39
|
+
top: posy,
|
|
40
|
+
width: width,
|
|
41
|
+
height: height,
|
|
42
|
+
color: "#FFFFFF",
|
|
43
|
+
backgroundColor: this.focus ? "#FF0000" : this.data.color,
|
|
44
|
+
animation: this.anim,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
data() {
|
|
49
|
+
return {
|
|
50
|
+
focus: false,
|
|
51
|
+
anim: null,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
created() {
|
|
55
|
+
this.onAction.register("onFocus", this.onFocus);
|
|
56
|
+
this.onAction.register("onBlur", this.onBlur);
|
|
57
|
+
this.onAction.register("onClick", this.onClick);
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<template>
|
|
63
|
+
<div :style="{ ...getStyle() }">
|
|
64
|
+
{{ data.content }}
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<style scoped>
|
|
69
|
+
@keyframes focusScale {
|
|
70
|
+
from {
|
|
71
|
+
transform: scale3d(0.8, 0.8, 1);
|
|
72
|
+
transform-origin: center center;
|
|
73
|
+
}
|
|
74
|
+
to {
|
|
75
|
+
transform: scale3d(1, 1, 1);
|
|
76
|
+
transform-origin: center center;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@keyframes blurScale {
|
|
81
|
+
from {
|
|
82
|
+
transform: scale3d(1.25, 1.25, 1);
|
|
83
|
+
transform-origin: center center;
|
|
84
|
+
}
|
|
85
|
+
to {
|
|
86
|
+
transform: scale3d(1, 1, 1);
|
|
87
|
+
transform-origin: center center;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|