@shijiu/jsview-vue 2.1.200 → 2.1.339-test.0
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/bin/browser/BrowserApic.vue.mjs +124 -0
- package/bin/browser/BrowserApic2.vue.mjs +118 -0
- package/bin/browser/BrowserApicLib.mjs +424 -0
- package/bin/browser/BrowserAudio.vue.mjs +263 -0
- package/bin/browser/BrowserJsvLatex.vue.mjs +110 -0
- package/bin/browser/BrowserJsvPlayer.vue.mjs +573 -0
- package/bin/browser/BrowserPreload.vue.mjs +154 -0
- package/bin/browser/BrowserQrcode.vue.mjs +178 -0
- package/bin/browser/BrowserSpray.vue.mjs +66 -0
- package/bin/browser/BrowserTextureAnim.vue.mjs +324 -0
- package/bin/export-sfc.mjs +12 -0
- package/bin/jsview-common.mjs +39 -0
- package/bin/jsview-vue.mjs +21106 -0
- package/index.js +3 -4
- package/package.json +1 -2
- package/tools/config/rollup.config.mjs +52 -0
- package/tools/config/tsconfig.json +18 -0
- package/tools/config/vite.config.ts +60 -0
- package/tools/jsview-vue-build.mjs +125 -0
- package/utils/JsViewEngineWidget/{JsvFocusBlock.vue → JsvFocus/JsvFocusBlock.vue} +11 -11
- package/utils/JsViewEngineWidget/{JsvFocusHub.ts → JsvFocus/JsvFocusHub.ts} +9 -3
- package/utils/JsViewEngineWidget/{JsvFocusManager.js → JsvFocus/JsvFocusManager.js} +6 -5
- package/utils/JsViewEngineWidget/MetroWidget/AnimationManager.ts +33 -10
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +89 -57
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +118 -62
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +504 -60
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +11 -1
- package/utils/JsViewEngineWidget/MetroWidget/SlotComponent.vue +13 -0
- package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +1 -1
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +1 -1
- package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +34 -1
- package/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.ts +52 -11
- package/utils/JsViewEngineWidget/index.js +3 -3
- package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +9 -0
- package/utils/JsViewPlugin/JsvAudio/BrowserAudio/BrowserAudio.vue +11 -3
- package/utils/JsViewPlugin/JsvAudio/JsvAudio.vue +1 -0
- package/utils/JsViewPlugin/JsvAudio/JsvAudioBridgeProxy.js +8 -0
- package/utils/JsViewPlugin/JsvAudio/ScreenLockManager.js +16 -0
- package/utils/JsViewPlugin/JsvAudio/version.js +3 -3
- package/utils/JsViewPlugin/JsvAudio/version.mjs +3 -3
- package/utils/JsViewPlugin/JsvLatex/index.js +1 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +1 -1
- package/utils/JsViewPlugin/JsvPlayer/index-0.9.js +3 -3
- package/utils/JsViewPlugin/JsvPlayer/index.js +2 -2
- package/utils/JsViewVueTools/DebugTool.js +2 -2
- package/utils/JsViewVueTools/DefaultKeyMap.js +1 -1
- package/utils/JsViewVueTools/JsvDynamicCssStyle.js +1 -1
- package/utils/JsViewVueTools/JsvDynamicKeyFrames.js +2 -2
- package/utils/JsViewVueTools/JsvImpactTracer.js +7 -7
- package/utils/JsViewVueTools/JsvPreDownloader.ts +1 -1
- package/utils/JsViewVueTools/JsvRefTaker.js +2 -1
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +29 -29
- package/utils/JsViewVueTools/JsvStyleClass.js +3 -3
- package/utils/JsViewVueTools/JsvStyleSheetsDeclarer.js +1 -1
- package/utils/JsViewVueTools/JsvTextTools.js +4 -4
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CanvasTexture.ts +29 -1
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.ts +6 -5
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +60 -2
- package/utils/JsViewVueTools/NinePatchHelper.js +1 -1
- package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +1 -1
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +1 -1
- package/utils/JsViewVueWidget/JsvApic/{BrowserApic → JsvApic}/BrowserApic.vue +20 -23
- package/utils/JsViewVueWidget/JsvApic/{JsvApic.vue → JsvApic/JsvApic.vue} +3 -14
- package/utils/JsViewVueWidget/JsvApic/{index.js → JsvApic/index.js} +2 -4
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue +116 -0
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue +137 -0
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/index.js +17 -0
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/BrowserApicLib.js +4 -0
- package/utils/JsViewVueWidget/JsvApic/{BrowserApic → JsvBrowserApicLib}/NormalLoopTool.js +16 -18
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/PartLoopTool.js +90 -0
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/SingleLoopTool.js +17 -0
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.js +111 -0
- package/utils/JsViewVueWidget/JsvApic/JsvCommonLoopToolBase.js +48 -0
- package/utils/JsViewVueWidget/JsvConnectLine/ArcLineManager.js +71 -0
- package/utils/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue +354 -0
- package/utils/JsViewVueWidget/JsvConnectLine/index.js +2 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts +37 -18
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.ts +7 -3
- package/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue +28 -2
- package/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue +12 -5
- package/utils/JsViewVueWidget/JsvFreeMoveActor/NexusNode.ts +21 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +47 -59
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +129 -12
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +45 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/index.js +10 -2
- package/utils/JsViewVueWidget/JsvGrid.vue +1 -1
- package/utils/JsViewVueWidget/JsvHole.js +1 -1
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +1 -1
- package/utils/JsViewVueWidget/JsvLine/JsvLine.vue +2 -2
- package/utils/JsViewVueWidget/JsvLine/LineManager.js +6 -4
- package/utils/JsViewVueWidget/JsvMarquee.vue +7 -4
- package/utils/JsViewVueWidget/JsvPieChart.vue +1 -1
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +1 -1
- package/utils/JsViewVueWidget/JsvPreload/index.js +1 -1
- package/utils/JsViewVueWidget/JsvProgressBar.vue +172 -0
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +0 -1
- package/utils/JsViewVueWidget/JsvQrcode/index.js +1 -1
- package/utils/JsViewVueWidget/JsvRadarChart.vue +1 -1
- package/utils/JsViewVueWidget/JsvScaleTextBox.vue +0 -2
- package/utils/JsViewVueWidget/JsvSector.vue +1 -1
- package/utils/JsViewVueWidget/JsvSoundPool.js +1 -1
- package/utils/JsViewVueWidget/JsvSpray/index.js +1 -1
- package/utils/JsViewVueWidget/JsvSpriteAnim/FrameBuidler.ts +235 -0
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +433 -401
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteLoader.vue +120 -0
- package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +2 -2
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +5 -5
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +425 -422
- package/utils/JsViewVueWidget/JsvVisibleSensor/index.js +1 -1
- package/utils/JsViewVueWidget/index.js +7 -3
- package/utils/index.js +4 -0
- package/utils/JsViewVueWidget/JsvApic/BrowserApic/LoopToolBase.js +0 -25
- package/utils/JsViewVueWidget/JsvApic/BrowserApic/PartLoopTool.js +0 -119
- package/utils/JsViewVueWidget/JsvApic/BrowserApic/Viewer.js +0 -106
- /package/utils/JsViewPlugin/JsvLatex/{JsvLatexBrowser.vue → BrowserJsvLatex.vue} +0 -0
- /package/utils/JsViewPlugin/JsvPlayer/{JsvPlayerBrowser-0.9.vue → BrowserJsvPlayer-0.9.vue} +0 -0
- /package/utils/JsViewPlugin/JsvPlayer/{JsvPlayerBrowser.vue → BrowserJsvPlayer.vue} +0 -0
- /package/utils/JsViewVueWidget/JsvApic/{BrowserApic → JsvBrowserApicLib}/ApicDataBase.js +0 -0
- /package/utils/JsViewVueWidget/JsvApic/{BrowserApic → JsvBrowserApicLib}/GifData.js +0 -0
- /package/utils/JsViewVueWidget/JsvApic/{BrowserApic → JsvBrowserApicLib}/WebpData.js +0 -0
|
@@ -1,449 +1,452 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* 【模块 export 内容】
|
|
3
|
-
*
|
|
3
|
+
* JsvSwiper3D:Vue高阶组件,图片轮播3D组件
|
|
4
4
|
* props说明:
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* indicatorPos {int} 指示点位置, 横向时为距顶端的位置,默认为高的80%;纵向时为距左端的位置,默认为宽的80%
|
|
9
|
-
* indicatorAlign {String} 指示面板的 align, 值为 start / middle / end,默认为middle
|
|
10
|
-
* totalFrame {int} (必需)item 的个数
|
|
11
|
-
* firstFrame {int} 初始 item 的 index,默认为0
|
|
12
|
-
* layoutInfo {Object} (必需)组件的大小 {width: 0, height: 0}
|
|
5
|
+
* dispNumber {int} (必需) 需要展示的item 的个数
|
|
6
|
+
* initIndex {int} 初始 item 的 index,默认为展示个数的中间项
|
|
7
|
+
* layoutInfo {Object} (必需)组件的大小 {width: 0, height: 0,left:0,top:0}
|
|
13
8
|
* onClick {Function} 点击事件 function () {}
|
|
14
9
|
* onChange {Function} 滚动事件 function (index) {}
|
|
15
|
-
*
|
|
16
|
-
* animation {Object} 滚动动画设置 {duration: 0, easing: "linear"}
|
|
17
|
-
* vertical {boolean} 组件是否为纵向的,默认为 false
|
|
10
|
+
* duration {number} 动画时长 单位:秒
|
|
18
11
|
* name {String} 组件获得焦点的 name
|
|
19
12
|
* onFocus {Function} 获得焦点的回调
|
|
20
13
|
* onBlur {Function} 失去焦点的回调
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* backgroundColor {String} 组件背景颜色
|
|
25
|
-
* scale {float} 当前 item 的放大倍数, 默认为1
|
|
26
|
-
* reverseSwipe {boolean} 反转滚动方向,默认值为false. 默认滚动方向是正向, 既向index增大的方向, 反转后为反向, 既向index减小的方向
|
|
14
|
+
* ItemArray {Array} (必需) 总数组{要有image属性}
|
|
15
|
+
* sideScale {float} 边缘缩小倍数
|
|
16
|
+
* initItemStyle {Object} (必需)中间最大项的style{width,height}
|
|
27
17
|
-->
|
|
28
18
|
|
|
29
|
-
<script>
|
|
30
|
-
import Indicator from "./Indicator.vue";
|
|
31
|
-
import { ref } from "vue";
|
|
32
|
-
import JsvVisibleSensor from "jsview/utils/JsViewVueWidget/JsvVisibleSensor";
|
|
33
|
-
|
|
34
|
-
const VIEW_NUM = 4;
|
|
35
|
-
|
|
36
|
-
function modToRange(value, mod, start = 0) {
|
|
37
|
-
let m = value % mod;
|
|
38
|
-
if (m < start) {
|
|
39
|
-
m += mod;
|
|
40
|
-
} else if (m >= start + mod) {
|
|
41
|
-
m -= mod;
|
|
42
|
-
}
|
|
43
|
-
return m;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
window.modToRange = modToRange;
|
|
47
|
-
|
|
48
|
-
export default {
|
|
49
|
-
components: { Indicator, JsvVisibleSensor },
|
|
50
|
-
props: {
|
|
51
|
-
showIndicator: {
|
|
52
|
-
type: Boolean,
|
|
53
|
-
default: true,
|
|
54
|
-
},
|
|
55
|
-
dotSize: {
|
|
56
|
-
type: Number,
|
|
57
|
-
default: 10,
|
|
58
|
-
},
|
|
59
|
-
dotGap: {
|
|
60
|
-
type: Number,
|
|
61
|
-
default: 10,
|
|
62
|
-
},
|
|
63
|
-
indicatorPos: {
|
|
64
|
-
type: Number,
|
|
65
|
-
default: -1,
|
|
66
|
-
},
|
|
67
|
-
indicatorAlign: {
|
|
68
|
-
type: String,
|
|
69
|
-
default: "middle",
|
|
70
|
-
},
|
|
71
|
-
totalFrame: {
|
|
72
|
-
type: Number,
|
|
73
|
-
require: true,
|
|
74
|
-
},
|
|
75
|
-
firstFrame: {
|
|
76
|
-
type: Number,
|
|
77
|
-
default: 0,
|
|
78
|
-
},
|
|
79
|
-
layoutInfo: {
|
|
80
|
-
type: Object,
|
|
81
|
-
require: true,
|
|
82
|
-
},
|
|
83
|
-
onClick: {
|
|
84
|
-
type: Function,
|
|
85
|
-
},
|
|
86
|
-
onChange: {
|
|
87
|
-
type: Function,
|
|
88
|
-
},
|
|
89
|
-
scale: {
|
|
90
|
-
type: Number,
|
|
91
|
-
default: 1.0,
|
|
92
|
-
},
|
|
93
|
-
autoplayInterval: {
|
|
94
|
-
type: Number,
|
|
95
|
-
default: 5000,
|
|
96
|
-
},
|
|
97
|
-
animation: {
|
|
98
|
-
type: Object,
|
|
99
|
-
default() {
|
|
100
|
-
return {
|
|
101
|
-
duration: 200,
|
|
102
|
-
easing: "linear",
|
|
103
|
-
};
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
vertical: {
|
|
107
|
-
type: Boolean,
|
|
108
|
-
default: false,
|
|
109
|
-
},
|
|
110
|
-
name: {
|
|
111
|
-
type: String,
|
|
112
|
-
},
|
|
113
|
-
onFocus: {
|
|
114
|
-
type: Function,
|
|
115
|
-
},
|
|
116
|
-
onBlur: {
|
|
117
|
-
type: Function,
|
|
118
|
-
},
|
|
119
|
-
backgroundImage: {
|
|
120
|
-
type: String,
|
|
121
|
-
},
|
|
122
|
-
backgroundColor: {
|
|
123
|
-
type: String,
|
|
124
|
-
},
|
|
125
|
-
reverseSwipe: {
|
|
126
|
-
type: Boolean,
|
|
127
|
-
default: false,
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
computed: {
|
|
131
|
-
indicatorLayout() {
|
|
132
|
-
let indicatorSize =
|
|
133
|
-
this.totalFrame * (this.dotSize + this.dotGap) - this.dotGap;
|
|
134
|
-
if (this.vertical) {
|
|
135
|
-
let top;
|
|
136
|
-
if (this.indicatorAlign === "start") {
|
|
137
|
-
top = this.dotGap;
|
|
138
|
-
} else if (this.indicatorAlign === "end") {
|
|
139
|
-
top = this.layoutInfo.widgetHeight - indicatorSize - this.dotGap;
|
|
140
|
-
} else {
|
|
141
|
-
top = (this.layoutInfo.widgetHeight - indicatorSize) / 2;
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
left:
|
|
145
|
-
this.indicatorPos < 0
|
|
146
|
-
? this.layoutInfo.widgetWidth * 0.8
|
|
147
|
-
: this.indicatorPos,
|
|
148
|
-
top,
|
|
149
|
-
zIndex: 1,
|
|
150
|
-
};
|
|
151
|
-
} else {
|
|
152
|
-
let left;
|
|
153
|
-
if (this.indicatorAlign === "start") {
|
|
154
|
-
left = this.dotGap;
|
|
155
|
-
} else if (this.indicatorAlign === "end") {
|
|
156
|
-
left = this.layoutInfo.widgetWidth - indicatorSize - this.dotGap;
|
|
157
|
-
} else {
|
|
158
|
-
left = (this.layoutInfo.widgetWidth - indicatorSize) / 2;
|
|
159
|
-
}
|
|
160
|
-
return {
|
|
161
|
-
left,
|
|
162
|
-
top:
|
|
163
|
-
this.indicatorPos < 0
|
|
164
|
-
? this.layoutInfo.widgetHeight * 0.8
|
|
165
|
-
: this.indicatorPos,
|
|
166
|
-
zIndex: 1,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
indicatorDotSize() {
|
|
171
|
-
return this.dotSize + this.dotGap;
|
|
172
|
-
},
|
|
173
|
-
currentDataIndex() {
|
|
174
|
-
return modToRange(this.firstFrame + this.offset, this.totalFrame);
|
|
175
|
-
},
|
|
176
|
-
currentViewIndex() {
|
|
177
|
-
return modToRange(this.offset + (VIEW_NUM / 2 - 1), VIEW_NUM);
|
|
178
|
-
},
|
|
179
|
-
viewInfoList() {
|
|
180
|
-
let layoutInfo = this.layoutInfo;
|
|
181
|
-
let currentLeft =
|
|
182
|
-
(this.layoutInfo.widgetWidth - this.layoutInfo.frameWidth) / 2;
|
|
183
|
-
let currentTop =
|
|
184
|
-
(this.layoutInfo.widgetHeight - this.layoutInfo.frameHeight) / 2;
|
|
185
|
-
let duration = this.animation.duration / 1000;
|
|
186
|
-
let easing = this.animation.easing ? this.animation.easing : "linear";
|
|
187
|
-
let styleList = [
|
|
188
|
-
{
|
|
189
|
-
layout: {
|
|
190
|
-
top: currentTop + (this.vertical ? -layoutInfo.deltaPos : 0),
|
|
191
|
-
left: currentLeft + (this.vertical ? 0 : -layoutInfo.deltaPos),
|
|
192
|
-
zIndex: this.offset - this.preOffset > 0 ? 3 : 1,
|
|
193
|
-
transition: `left ${duration}s ${easing}, top ${duration}s ${easing}`,
|
|
194
|
-
},
|
|
195
|
-
transform: {
|
|
196
|
-
transform: `scale3d(${this.scale}, ${this.scale}, 1.0)`,
|
|
197
|
-
width: this.layoutInfo.frameWidth,
|
|
198
|
-
height: this.layoutInfo.frameHeight,
|
|
199
|
-
transition: `transform ${duration}s ${easing}`,
|
|
200
|
-
},
|
|
201
|
-
} /*左副位*/,
|
|
202
|
-
{
|
|
203
|
-
layout: {
|
|
204
|
-
top: currentTop,
|
|
205
|
-
left: currentLeft,
|
|
206
|
-
zIndex: 4,
|
|
207
|
-
transition: `left ${duration}s ${easing}, top ${duration}s ${easing}`,
|
|
208
|
-
},
|
|
209
|
-
transform: {
|
|
210
|
-
transform: "scale3d(1.0, 1.0, 1.0)",
|
|
211
|
-
width: this.layoutInfo.frameWidth,
|
|
212
|
-
height: this.layoutInfo.frameHeight,
|
|
213
|
-
transition: `transform ${duration}s ${easing}`,
|
|
214
|
-
},
|
|
215
|
-
} /*主位*/,
|
|
216
|
-
{
|
|
217
|
-
layout: {
|
|
218
|
-
top: currentTop + (this.vertical ? layoutInfo.deltaPos : 0),
|
|
219
|
-
left: currentLeft + (this.vertical ? 0 : layoutInfo.deltaPos),
|
|
220
|
-
zIndex: this.offset - this.preOffset > 0 ? 1 : 3,
|
|
221
|
-
transition: `left ${duration}s ${easing}, top ${duration}s ${easing}`,
|
|
222
|
-
},
|
|
223
|
-
transform: {
|
|
224
|
-
transform: `scale3d(${this.scale}, ${this.scale}, 1.0)`,
|
|
225
|
-
width: this.layoutInfo.frameWidth,
|
|
226
|
-
height: this.layoutInfo.frameHeight,
|
|
227
|
-
transition: `transform ${duration}s ${easing}`,
|
|
228
|
-
},
|
|
229
|
-
} /*右副位*/,
|
|
230
|
-
{
|
|
231
|
-
layout: {
|
|
232
|
-
top: currentTop,
|
|
233
|
-
left: currentLeft,
|
|
234
|
-
zIndex: 0,
|
|
235
|
-
transition: `left ${duration}s ${easing}, top ${duration}s ${easing}`,
|
|
236
|
-
},
|
|
237
|
-
transform: {
|
|
238
|
-
transform: `scale3d(${this.scale}, ${this.scale}, 1.0)`,
|
|
239
|
-
width: this.layoutInfo.frameWidth,
|
|
240
|
-
height: this.layoutInfo.frameHeight,
|
|
241
|
-
transition: `transform ${duration}s ${easing}`,
|
|
242
|
-
},
|
|
243
|
-
} /*隐藏位*/,
|
|
244
|
-
];
|
|
245
|
-
let viewList = [];
|
|
246
|
-
for (let i = 0; i < VIEW_NUM; i++) {
|
|
247
|
-
viewList.push({
|
|
248
|
-
dataIndex: modToRange(
|
|
249
|
-
this.currentDataIndex +
|
|
250
|
-
modToRange(i - this.currentViewIndex, VIEW_NUM, -1),
|
|
251
|
-
this.totalFrame
|
|
252
|
-
),
|
|
253
|
-
style: styleList[modToRange(i - this.offset, VIEW_NUM)],
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
return viewList;
|
|
257
|
-
},
|
|
258
|
-
},
|
|
259
|
-
setup() {
|
|
260
|
-
let preOffset = -1;
|
|
261
|
-
let offset = ref(0);
|
|
262
|
-
let focused = ref(false);
|
|
263
|
-
let intervalHandler = -1;
|
|
264
|
-
return {
|
|
265
|
-
preOffset,
|
|
266
|
-
offset,
|
|
267
|
-
focused,
|
|
268
|
-
intervalHandler,
|
|
269
|
-
};
|
|
270
|
-
},
|
|
271
|
-
watch: {
|
|
272
|
-
offset(newValue) {
|
|
273
|
-
this.onChange?.(modToRange(this.firstFrame + newValue, this.totalFrame));
|
|
274
|
-
},
|
|
275
|
-
},
|
|
276
|
-
methods: {
|
|
277
|
-
_onKeyDown(ev) {
|
|
278
|
-
switch (ev.keyCode) {
|
|
279
|
-
case 37:
|
|
280
|
-
if (!this.vertical) {
|
|
281
|
-
this.preOffset = this.offset;
|
|
282
|
-
this.offset = this.offset - 1;
|
|
283
|
-
return true;
|
|
284
|
-
}
|
|
285
|
-
break;
|
|
286
|
-
case 38:
|
|
287
|
-
if (this.vertical) {
|
|
288
|
-
this.preOffset = this.offset;
|
|
289
|
-
this.offset = this.offset - 1;
|
|
290
|
-
return true;
|
|
291
|
-
}
|
|
292
|
-
break;
|
|
293
|
-
case 39:
|
|
294
|
-
if (!this.vertical) {
|
|
295
|
-
this.preOffset = this.offset;
|
|
296
|
-
this.offset = this.offset + 1;
|
|
297
|
-
return true;
|
|
298
|
-
}
|
|
299
|
-
break;
|
|
300
|
-
case 40:
|
|
301
|
-
if (this.vertical) {
|
|
302
|
-
this.preOffset = this.offset;
|
|
303
|
-
this.offset = this.offset + 1;
|
|
304
|
-
return true;
|
|
305
|
-
}
|
|
306
|
-
break;
|
|
307
|
-
case 13:
|
|
308
|
-
this.onClick?.();
|
|
309
|
-
return true;
|
|
310
|
-
default:
|
|
311
|
-
break;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
return false;
|
|
315
|
-
},
|
|
316
|
-
_enableAutoplay() {
|
|
317
|
-
if (this.autoplayInterval > 0) {
|
|
318
|
-
this.intervalHandler = setInterval(() => {
|
|
319
|
-
this.preOffset = this.offset;
|
|
320
|
-
this.offset = this.offset + this.reverseSwipe ? -1 : 1;
|
|
321
|
-
}, this.autoplayInterval);
|
|
322
|
-
}
|
|
323
|
-
},
|
|
324
|
-
_stopAutoPlay() {
|
|
325
|
-
clearInterval(this.intervalHandler);
|
|
326
|
-
this.intervalHandler = -1;
|
|
327
|
-
},
|
|
328
|
-
_onFocus() {
|
|
329
|
-
this.focused = true;
|
|
330
|
-
clearInterval(this.intervalHandler);
|
|
331
|
-
this.onFocus?.();
|
|
332
|
-
},
|
|
333
|
-
_onBlur() {
|
|
334
|
-
this.focused = false;
|
|
335
|
-
this._enableAutoplay();
|
|
336
|
-
this.onBlur?.();
|
|
337
|
-
},
|
|
338
|
-
onBeVisible(old_h, new_h, old_v, new_v) {
|
|
339
|
-
if ((old_h && !new_h) || (old_v && !new_h)) {
|
|
340
|
-
this._stopAutoPlay();
|
|
341
|
-
} else if ((!old_h && new_h) || (!old_v && new_h)) {
|
|
342
|
-
this._enableAutoplay();
|
|
343
|
-
}
|
|
344
|
-
},
|
|
345
|
-
},
|
|
346
|
-
created() {
|
|
347
|
-
this._enableAutoplay();
|
|
348
|
-
},
|
|
349
|
-
};
|
|
350
|
-
</script>
|
|
351
|
-
|
|
352
19
|
<template>
|
|
353
|
-
<jsv-
|
|
354
|
-
|
|
355
|
-
:verticalShown="0.2"
|
|
356
|
-
:width="layoutInfo.widgetWidth"
|
|
357
|
-
:height="layoutInfo.widgetHeight"
|
|
358
|
-
:enable="true"
|
|
359
|
-
:callback="onBeVisible"
|
|
360
|
-
></jsv-visible-sensor>
|
|
361
|
-
<jsv-focus-block
|
|
362
|
-
:name="name"
|
|
363
|
-
:onAction="{
|
|
364
|
-
onFocus: _onFocus,
|
|
365
|
-
onBlur: _onBlur,
|
|
366
|
-
onKeyDown: _onKeyDown,
|
|
367
|
-
}"
|
|
368
|
-
>
|
|
20
|
+
<jsv-focus-block :onAction="onActionObj" :name="props.name">
|
|
21
|
+
<!-- 可视区域 -->
|
|
369
22
|
<div
|
|
370
23
|
:style="{
|
|
371
|
-
width: layoutInfo.widgetWidth,
|
|
372
|
-
height: layoutInfo.widgetHeight,
|
|
373
24
|
overflow: 'hidden',
|
|
25
|
+
width: props.layoutInfo.width,
|
|
26
|
+
height: props.layoutInfo.height,
|
|
27
|
+
left: props.layoutInfo.left,
|
|
28
|
+
top: props.layoutInfo.top,
|
|
374
29
|
}"
|
|
375
30
|
>
|
|
376
|
-
<div
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
:
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
backgroundColor,
|
|
385
|
-
}"
|
|
386
|
-
/>
|
|
31
|
+
<div
|
|
32
|
+
:style="{
|
|
33
|
+
width: items.length * space,
|
|
34
|
+
height: props.layoutInfo.height,
|
|
35
|
+
left: 0,
|
|
36
|
+
}"
|
|
37
|
+
>
|
|
38
|
+
<!-- 平移 -->
|
|
387
39
|
<div
|
|
388
|
-
v-for="(item, index) in
|
|
389
|
-
:key="index"
|
|
390
|
-
:style="
|
|
40
|
+
v-for="(item, index) in items"
|
|
41
|
+
:key="item.image + `${index}`"
|
|
42
|
+
:style="getItemStyle(index)"
|
|
391
43
|
>
|
|
392
|
-
|
|
44
|
+
<!-- 缩放 -->
|
|
45
|
+
<div :style="scaleItemStyle(index)">
|
|
393
46
|
<slot
|
|
394
47
|
name="itemView"
|
|
395
|
-
:currentIndex="currentDataIndex"
|
|
396
48
|
:dataIndex="item.dataIndex"
|
|
397
|
-
:
|
|
49
|
+
:item="item"
|
|
398
50
|
></slot>
|
|
399
|
-
<!-- <div
|
|
400
|
-
:style="{
|
|
401
|
-
width: 50,
|
|
402
|
-
height: 50,
|
|
403
|
-
top: 50,
|
|
404
|
-
fontSize: '30px',
|
|
405
|
-
color: '#FF0000'
|
|
406
|
-
}"
|
|
407
|
-
>
|
|
408
|
-
{{ index }}
|
|
409
|
-
</div> -->
|
|
410
51
|
</div>
|
|
411
52
|
</div>
|
|
412
53
|
</div>
|
|
413
|
-
|
|
414
|
-
<div v-if="showIndicator" :style="indicatorLayout">
|
|
415
|
-
<indicator
|
|
416
|
-
:number="totalFrame"
|
|
417
|
-
:current="currentDataIndex"
|
|
418
|
-
:itemSize="indicatorDotSize"
|
|
419
|
-
:vertical="vertical"
|
|
420
|
-
>
|
|
421
|
-
<template #current>
|
|
422
|
-
<slot name="indicatorCur">
|
|
423
|
-
<div
|
|
424
|
-
:style="{
|
|
425
|
-
width: 10,
|
|
426
|
-
height: 10,
|
|
427
|
-
backgroundColor: 'rgba(50, 50, 50, 1.0)',
|
|
428
|
-
borderRadius: '5px',
|
|
429
|
-
}"
|
|
430
|
-
></div>
|
|
431
|
-
</slot>
|
|
432
|
-
</template>
|
|
433
|
-
<template #normal>
|
|
434
|
-
<slot name="indicatorNor">
|
|
435
|
-
<div
|
|
436
|
-
:style="{
|
|
437
|
-
width: 10,
|
|
438
|
-
height: 10,
|
|
439
|
-
backgroundColor: 'rgba(100, 100, 100, 0.7)',
|
|
440
|
-
borderRadius: '5px',
|
|
441
|
-
}"
|
|
442
|
-
></div>
|
|
443
|
-
</slot>
|
|
444
|
-
</template>
|
|
445
|
-
</indicator>
|
|
446
|
-
</div>
|
|
447
54
|
</div>
|
|
448
55
|
</jsv-focus-block>
|
|
449
|
-
</template>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script setup>
|
|
59
|
+
import { reactive, shallowRef } from "vue";
|
|
60
|
+
import { getKeyFramesGroup } from '../../JsViewVueTools/JsvDynamicKeyFrames.js'
|
|
61
|
+
|
|
62
|
+
const props = defineProps({
|
|
63
|
+
dispNumber: { type: Number, require: true },
|
|
64
|
+
initIndex: { type: Number },
|
|
65
|
+
layoutInfo: { type: Object, require: true },
|
|
66
|
+
duration: { type: Number, require: true },
|
|
67
|
+
sideScale: { type: Number, require: true },
|
|
68
|
+
name: { type: String, require: true },
|
|
69
|
+
ItemArray: { type: Array, require: true },
|
|
70
|
+
initItemStyle: { type: Object, require: true },
|
|
71
|
+
onFocus: { type: Function },
|
|
72
|
+
onBlur: { type: Function },
|
|
73
|
+
onClick: { type: Function },
|
|
74
|
+
onChange: { type: Function },
|
|
75
|
+
});
|
|
76
|
+
let currentId;
|
|
77
|
+
let preFocusedIdx;
|
|
78
|
+
if (props.initIndex == undefined) {
|
|
79
|
+
currentId = Math.floor(props.dispNumber / 2);
|
|
80
|
+
} else {
|
|
81
|
+
currentId = props.initIndex;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
//处理原数组
|
|
85
|
+
let items = reactive(new Array(props.dispNumber + 2));
|
|
86
|
+
let allItems = [];
|
|
87
|
+
|
|
88
|
+
let length = props.ItemArray.length;
|
|
89
|
+
|
|
90
|
+
if (length < props.dispNumber) {
|
|
91
|
+
throw new Error("数量不足");
|
|
92
|
+
} else {
|
|
93
|
+
for (let i = 0; i < props.ItemArray.length; i++) {
|
|
94
|
+
allItems.push({
|
|
95
|
+
...props.ItemArray[i],
|
|
96
|
+
dataIndex: i,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
//计算间距
|
|
102
|
+
let space = shallowRef(0);
|
|
103
|
+
|
|
104
|
+
//处理原数组
|
|
105
|
+
//如果item数量等于总数量
|
|
106
|
+
let direction = "left";
|
|
107
|
+
let focusedIdx = currentId;
|
|
108
|
+
let prevNumber = Math.floor(props.dispNumber / 2) + 1;
|
|
109
|
+
const move1 = () => {
|
|
110
|
+
for (let i = 0; i < props.dispNumber + 2; i++) {
|
|
111
|
+
let itemIdx = focusedIdx - prevNumber + i;
|
|
112
|
+
if (itemIdx < 0) {
|
|
113
|
+
itemIdx += props.ItemArray.length;
|
|
114
|
+
} else if (itemIdx >= props.ItemArray.length) {
|
|
115
|
+
itemIdx -= props.ItemArray.length;
|
|
116
|
+
}
|
|
117
|
+
items[i] = allItems[itemIdx];
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
move1();
|
|
122
|
+
|
|
123
|
+
let posAni = shallowRef("");
|
|
124
|
+
let scaleAni = shallowRef("");
|
|
125
|
+
let currentAni = shallowRef("");
|
|
126
|
+
let pos0Ani = shallowRef("");
|
|
127
|
+
let leftArray = reactive([]);
|
|
128
|
+
|
|
129
|
+
let midIndex = Math.floor(items.length / 2);
|
|
130
|
+
for (let i = 0; i < items.length; i++) {
|
|
131
|
+
leftArray.push({
|
|
132
|
+
index: null,
|
|
133
|
+
width: null,
|
|
134
|
+
left: null,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
//计算每个样式
|
|
138
|
+
for (let index = 0; index < items.length; index++) {
|
|
139
|
+
let currentIndex = Math.abs(index - Math.floor(items.length / 2));
|
|
140
|
+
let scale = 1 - currentIndex * props.sideScale;
|
|
141
|
+
const width = props.initItemStyle.width * scale;
|
|
142
|
+
if (index == items.length - 2) {
|
|
143
|
+
let startPosX = props.layoutInfo.width / 2;
|
|
144
|
+
let endPosX = props.layoutInfo.width - width / 2;
|
|
145
|
+
space.value = (endPosX - startPosX) / ((props.dispNumber - 1) / 2);
|
|
146
|
+
}
|
|
147
|
+
leftArray[index] = { index, width };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
//中间 left
|
|
151
|
+
for (let index = 0; index < items.length; index++) {
|
|
152
|
+
let startPosX = props.layoutInfo.width / 2;
|
|
153
|
+
if (index == Math.floor(items.length / 2)) {
|
|
154
|
+
leftArray[index].left = startPosX - leftArray[index].width / 2;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
//左边 left
|
|
158
|
+
for (let i = midIndex - 1; i >= 0; i--) {
|
|
159
|
+
let startPosX = leftArray[i + 1].left + leftArray[i + 1].width / 2;
|
|
160
|
+
leftArray[i].left = startPosX - space.value - leftArray[i].width / 2;
|
|
161
|
+
}
|
|
162
|
+
//右边 left
|
|
163
|
+
for (let i = midIndex + 1; i < items.length; i++) {
|
|
164
|
+
let startPosX = leftArray[i - 1].left + leftArray[i - 1].width / 2;
|
|
165
|
+
leftArray[i].left = startPosX + space.value - leftArray[i].width / 2;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const getItemStyle = (index) => {
|
|
169
|
+
let currentIndex;
|
|
170
|
+
let scale;
|
|
171
|
+
let zIndex;
|
|
172
|
+
let top;
|
|
173
|
+
let width;
|
|
174
|
+
let height;
|
|
175
|
+
let left;
|
|
176
|
+
currentIndex = Math.abs(index - Math.floor(items.length / 2));
|
|
177
|
+
scale = 1 - currentIndex * props.sideScale;
|
|
178
|
+
zIndex = items.length - currentIndex;
|
|
179
|
+
top = (props.initItemStyle.height - props.initItemStyle.height * scale) / 2;
|
|
180
|
+
width = leftArray[index].width;
|
|
181
|
+
height = props.initItemStyle.height * scale;
|
|
182
|
+
if (index == items.length - 2) {
|
|
183
|
+
let startPosX = props.layoutInfo.width / 2;
|
|
184
|
+
let endPosX = props.layoutInfo.width - width / 2;
|
|
185
|
+
space.value = (endPosX - startPosX) / ((props.dispNumber - 1) / 2);
|
|
186
|
+
}
|
|
187
|
+
left = leftArray[index].left;
|
|
188
|
+
items[index].top = top;
|
|
189
|
+
items[index].width = width;
|
|
190
|
+
items[index].height = height;
|
|
191
|
+
return {
|
|
192
|
+
zIndex,
|
|
193
|
+
left,
|
|
194
|
+
top,
|
|
195
|
+
width,
|
|
196
|
+
height,
|
|
197
|
+
animation: posAni.value,
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const scaleItemStyle = (index) => {
|
|
202
|
+
const currentIndex = Math.abs(index - Math.floor(items.length / 2));
|
|
203
|
+
const scale = 1 - currentIndex * props.sideScale; // 根据需要调整缩放比例
|
|
204
|
+
const backgroundImage = items[index].image;
|
|
205
|
+
const width = props.initItemStyle.width * scale;
|
|
206
|
+
const height = props.initItemStyle.height * scale;
|
|
207
|
+
|
|
208
|
+
items[index].backgroundImage = backgroundImage;
|
|
209
|
+
if (direction == "left") {
|
|
210
|
+
return {
|
|
211
|
+
width,
|
|
212
|
+
height,
|
|
213
|
+
animation:
|
|
214
|
+
index > (items.length - 1) / 2 ? scaleAni.value : currentAni.value,
|
|
215
|
+
};
|
|
216
|
+
} else {
|
|
217
|
+
return {
|
|
218
|
+
width,
|
|
219
|
+
height,
|
|
220
|
+
animation:
|
|
221
|
+
index < (items.length - 1) / 2 ? scaleAni.value : currentAni.value,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const onKeyDown = (ev) => {
|
|
227
|
+
switch (ev.keyCode) {
|
|
228
|
+
case 37:
|
|
229
|
+
direction = "left";
|
|
230
|
+
if (posAni.value == "") {
|
|
231
|
+
posAni.value = `slideToLeftA ${props.duration}s`;
|
|
232
|
+
} else if (posAni.value == `slideToLeftA ${props.duration}s`) {
|
|
233
|
+
posAni.value = `slideToLeftB ${props.duration}s`;
|
|
234
|
+
} else {
|
|
235
|
+
posAni.value = `slideToLeftA ${props.duration}s`;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (pos0Ani.value == "") {
|
|
239
|
+
pos0Ani.value = `slideToLeft0A ${props.duration}s`;
|
|
240
|
+
} else if (pos0Ani.value == `slideToLeft0A ${props.duration}s`) {
|
|
241
|
+
pos0Ani.value = `slideToLeft0B ${props.duration}s`;
|
|
242
|
+
} else {
|
|
243
|
+
pos0Ani.value = `slideToLeft0A ${props.duration}s`;
|
|
244
|
+
}
|
|
245
|
+
preFocusedIdx = focusedIdx;
|
|
246
|
+
focusedIdx--;
|
|
247
|
+
if (focusedIdx < 0) {
|
|
248
|
+
focusedIdx = props.ItemArray.length - 1;
|
|
249
|
+
} else if (focusedIdx >= props.ItemArray.length) {
|
|
250
|
+
focusedIdx = 0;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
move1();
|
|
254
|
+
scaleAniManager();
|
|
255
|
+
props.onChange?.(preFocusedIdx, focusedIdx);
|
|
256
|
+
break;
|
|
257
|
+
case 39:
|
|
258
|
+
direction = "right";
|
|
259
|
+
if (posAni.value == "") {
|
|
260
|
+
posAni.value = `slideToRightA ${props.duration}s`;
|
|
261
|
+
} else if (posAni.value == `slideToRightA ${props.duration}s`) {
|
|
262
|
+
posAni.value = `slideToRightB ${props.duration}s`;
|
|
263
|
+
} else {
|
|
264
|
+
posAni.value = `slideToRightA ${props.duration}s`;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (pos0Ani.value == "") {
|
|
268
|
+
pos0Ani.value = `slideToRight0A ${props.duration}s`;
|
|
269
|
+
} else if (pos0Ani.value == `slideToRight0A ${props.duration}s`) {
|
|
270
|
+
pos0Ani.value = `slideToRight0B ${props.duration}s`;
|
|
271
|
+
} else {
|
|
272
|
+
pos0Ani.value = `slideToRight0A ${props.duration}s`;
|
|
273
|
+
}
|
|
274
|
+
preFocusedIdx = focusedIdx;
|
|
275
|
+
focusedIdx++;
|
|
276
|
+
if (focusedIdx < 0) {
|
|
277
|
+
focusedIdx = props.ItemArray.length - 1;
|
|
278
|
+
} else if (focusedIdx >= props.ItemArray.length) {
|
|
279
|
+
focusedIdx = 0;
|
|
280
|
+
}
|
|
281
|
+
move1();
|
|
282
|
+
scaleAniManager();
|
|
283
|
+
props.onChange?.(preFocusedIdx, focusedIdx);
|
|
284
|
+
break;
|
|
285
|
+
case 13:
|
|
286
|
+
props.onClick?.(focusedIdx);
|
|
287
|
+
default:
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
//左边动画
|
|
293
|
+
let styleShell = getKeyFramesGroup();
|
|
294
|
+
let slideToLeftA = `@keyframes slideToLeftA {
|
|
295
|
+
from {
|
|
296
|
+
transform: translate3d(${-150}, 0, 0);
|
|
297
|
+
}
|
|
298
|
+
to {
|
|
299
|
+
transform: translate3d(0, 0, 0);
|
|
300
|
+
}
|
|
301
|
+
}`;
|
|
302
|
+
|
|
303
|
+
styleShell.insertRule(slideToLeftA);
|
|
304
|
+
//左边动画B
|
|
305
|
+
let slideToLeftB = `@keyframes slideToLeftB {
|
|
306
|
+
from {
|
|
307
|
+
transform: translate3d(${-150}, 0, 0);
|
|
308
|
+
}
|
|
309
|
+
to {
|
|
310
|
+
transform: translate3d(0, 0, 0);
|
|
311
|
+
}
|
|
312
|
+
}`;
|
|
313
|
+
|
|
314
|
+
styleShell.insertRule(slideToLeftB);
|
|
315
|
+
|
|
316
|
+
//右边动画A
|
|
317
|
+
let slideToRightA = `@keyframes slideToRightA {
|
|
318
|
+
from {
|
|
319
|
+
transform: translate3d(${150}, 0, 0);
|
|
320
|
+
}
|
|
321
|
+
to {
|
|
322
|
+
transform: translate3d(0, 0, 0);
|
|
323
|
+
}
|
|
324
|
+
}`;
|
|
325
|
+
|
|
326
|
+
styleShell.insertRule(slideToRightA);
|
|
327
|
+
//右边动画B
|
|
328
|
+
let slideToRightB = `@keyframes slideToRightB {
|
|
329
|
+
from {
|
|
330
|
+
transform: translate3d(${150}, 0, 0);
|
|
331
|
+
}
|
|
332
|
+
to {
|
|
333
|
+
transform: translate3d(0, 0, 0);
|
|
334
|
+
}
|
|
335
|
+
}`;
|
|
336
|
+
|
|
337
|
+
styleShell.insertRule(slideToRightB);
|
|
338
|
+
//缩小动画A
|
|
339
|
+
let lowerA = `@keyframes lowerA {
|
|
340
|
+
from {
|
|
341
|
+
transform: scale3d(1.1, 1.1, 1);
|
|
342
|
+
}
|
|
343
|
+
to {
|
|
344
|
+
transform: scale3d(1, 1, 1);
|
|
345
|
+
}
|
|
346
|
+
}`;
|
|
347
|
+
styleShell.insertRule(lowerA);
|
|
348
|
+
//缩小动画B
|
|
349
|
+
let lowerB = `@keyframes lowerB {
|
|
350
|
+
from {
|
|
351
|
+
transform: scale3d(1.1, 1.1, 1);
|
|
352
|
+
}
|
|
353
|
+
to {
|
|
354
|
+
transform: scale3d(1, 1, 1);
|
|
355
|
+
}
|
|
356
|
+
}`;
|
|
357
|
+
styleShell.insertRule(lowerB);
|
|
358
|
+
//放大动画A
|
|
359
|
+
let biggerA = `@keyframes biggerA {
|
|
360
|
+
from {
|
|
361
|
+
transform: scale3d(${1 / 1.1},${1 / 1.1} , 1);
|
|
362
|
+
}
|
|
363
|
+
to {
|
|
364
|
+
transform: scale3d(1, 1, 1);
|
|
365
|
+
}
|
|
366
|
+
}`;
|
|
367
|
+
styleShell.insertRule(biggerA);
|
|
368
|
+
//放大动画B
|
|
369
|
+
let biggerB = `@keyframes biggerB {
|
|
370
|
+
from {
|
|
371
|
+
transform: scale3d(${1 / 1.1},${1 / 1.1} , 1);
|
|
372
|
+
}
|
|
373
|
+
to {
|
|
374
|
+
transform: scale3d(1, 1, 1);
|
|
375
|
+
}
|
|
376
|
+
}`;
|
|
377
|
+
styleShell.insertRule(biggerB);
|
|
378
|
+
|
|
379
|
+
//第0项左移动画A
|
|
380
|
+
let slideToLeft0A = `@keyframes slideToLeft0A {
|
|
381
|
+
from {
|
|
382
|
+
transform: translate3d(${150}, 0, 0);
|
|
383
|
+
}
|
|
384
|
+
to {
|
|
385
|
+
transform: translate3d(0, 0, 0);
|
|
386
|
+
}
|
|
387
|
+
}`;
|
|
388
|
+
styleShell.insertRule(slideToLeft0A);
|
|
389
|
+
//第0项左移动画B
|
|
390
|
+
let slideToLeft0B = `@keyframes slideToLeft0B {
|
|
391
|
+
from {
|
|
392
|
+
transform: translate3d(${150}, 0, 0);
|
|
393
|
+
}
|
|
394
|
+
to {
|
|
395
|
+
transform: translate3d(0, 0, 0);
|
|
396
|
+
}
|
|
397
|
+
}`;
|
|
398
|
+
styleShell.insertRule(slideToLeft0B);
|
|
399
|
+
|
|
400
|
+
//页面最后一项右移动画A
|
|
401
|
+
let slideToRight0A = `@keyframes slideToRight0A {
|
|
402
|
+
from {
|
|
403
|
+
transform: translate3d(${-150}, 0, 0);
|
|
404
|
+
}
|
|
405
|
+
to {
|
|
406
|
+
transform: translate3d(0, 0, 0);
|
|
407
|
+
}
|
|
408
|
+
}`;
|
|
409
|
+
styleShell.insertRule(slideToRight0A);
|
|
410
|
+
|
|
411
|
+
//页面最后一项右移动画B
|
|
412
|
+
let slideToRight0B = `@keyframes slideToRight0B {
|
|
413
|
+
from {
|
|
414
|
+
transform: translate3d(${-150}, 0, 0);
|
|
415
|
+
}
|
|
416
|
+
to {
|
|
417
|
+
transform: translate3d(0, 0, 0);
|
|
418
|
+
}
|
|
419
|
+
}`;
|
|
420
|
+
styleShell.insertRule(slideToRight0B);
|
|
421
|
+
|
|
422
|
+
//缩放动画管理
|
|
423
|
+
const scaleAniManager = () => {
|
|
424
|
+
if (currentAni.value == "") {
|
|
425
|
+
currentAni.value = `biggerA ${props.duration}s`;
|
|
426
|
+
} else if (currentAni.value == `biggerA ${props.duration}s`) {
|
|
427
|
+
currentAni.value = `biggerB ${props.duration}s`;
|
|
428
|
+
} else if (currentAni.value == `biggerB ${props.duration}s`) {
|
|
429
|
+
currentAni.value = `biggerA ${props.duration}s`;
|
|
430
|
+
} else {
|
|
431
|
+
currentAni.value == `biggerA ${props.duration}s`;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
if (scaleAni.value == "") {
|
|
435
|
+
scaleAni.value = `lowerA ${props.duration}s`;
|
|
436
|
+
} else if (scaleAni.value == `lowerA ${props.duration}s`) {
|
|
437
|
+
scaleAni.value = `lowerB ${props.duration}s`;
|
|
438
|
+
} else if (scaleAni.value == `lowerB ${props.duration}s`) {
|
|
439
|
+
scaleAni.value = `lowerA ${props.duration}s`;
|
|
440
|
+
} else {
|
|
441
|
+
scaleAni.value == `lowerA ${props.duration}s`;
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
const onActionObj = {
|
|
446
|
+
onKeyDown,
|
|
447
|
+
onFocus: props.onFocus,
|
|
448
|
+
onBlur: props.onBlur,
|
|
449
|
+
};
|
|
450
|
+
</script>
|
|
451
|
+
|
|
452
|
+
<style scoped></style>
|