@shijiu/jsview-vue-samples 2.2.128 → 2.2.373
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/BakeViewDemo/App.vue +6 -1
- package/Basic/components/anim/AnimEasingCubicBezier.vue +56 -0
- package/Basic/components/anim/AnimGroup2.vue +33 -0
- package/Basic/components/panel/Panel2.vue +8 -3
- package/CoupletsTest/widget/Banger/Maroon.vue +4 -7
- package/CoupletsTest/widget/Fireworks/Fireworks.vue +52 -44
- package/CustomShader/App.vue +174 -0
- package/CustomShader/gaussianBlur.glsl +27 -0
- package/CustomShader/pageFlip.glsl +41 -0
- package/CustomShader/sdf.glsl +22 -0
- package/CustomShader/test.glsl +8 -0
- package/CustomShader/vortex.glsl +38 -0
- package/DemoHomepage/App.vue +50 -32
- package/DemoHomepage/components/Item.vue +23 -12
- package/DemoHomepage/index.d.ts +5 -2
- package/DemoHomepage/router.js +105 -72
- package/DispersedFocusControl/App.vue +67 -0
- package/DispersedFocusControl/Button.vue +76 -0
- package/DispersedFocusControl/data.js +44 -0
- package/DragBox/App.vue +148 -0
- package/DriftScopeTest/App.vue +128 -0
- package/FlexCellDemo/App.vue +47 -223
- package/FlexCellDemo/TestFrame1.vue +88 -0
- package/FlexCellDemo/TestFrame2.vue +100 -0
- package/FlexCellDemo/TestFrame3.vue +97 -0
- package/FlexCellDemo/TestFrame4.vue +60 -0
- package/FlexCellDemo/TestFrame5.vue +60 -0
- package/FlexCellDemo/images/6.jpg +0 -0
- package/FocusMoveStyle/App.vue +1 -0
- package/FocusMoveStyle/CreepFocus.vue +11 -1
- package/FocusMoveStyle/FoldableItem.vue +1 -1
- package/FreeMove/App.vue +62 -64
- package/FreeMoveLink/App.vue +2 -2
- package/FullScreenFlex/App.vue +42 -0
- package/FullScreenFlex/TestFrame2.vue +107 -0
- package/FullScreenFlex/images/1.png +0 -0
- package/HashHistory/App.vue +8 -4
- package/ImpactStop/App.vue +45 -45
- package/Input/App.vue +184 -97
- package/Input/InputPanel.vue +98 -82
- package/LatexFormula/App.vue +97 -10
- package/LongImage/App.vue +1 -2
- package/LongText/App.vue +2 -2
- package/LongText/LongTextScroll.vue +22 -22
- package/LongText/Scroll.vue +28 -9
- package/MetroWidgetDemos/RefreshDemo/App.vue +172 -56
- package/MetroWidgetDemos/RefreshDemo/ControlItem.vue +45 -0
- package/MetroWidgetDemos/RefreshDemo/Item.vue +20 -4
- package/MetroWidgetDemos/itemSizeUpdate/backward/Item.vue +1 -1
- package/MetroWidgetDemos/routeList.js +17 -17
- package/MindMap/App.vue +10 -1
- package/MindMap/data.js +34 -8
- package/Parkour/appConfig/jsview.config.mjs +0 -4
- package/PosterPacker/App.vue +207 -0
- package/PosterPacker/images/bg.jpg +0 -0
- package/PosterPacker/images/blue.png +0 -0
- package/PosterPacker/images/darkGreen.png +0 -0
- package/PosterPacker/images/left.png +0 -0
- package/PosterPacker/images/orange.png +0 -0
- package/PosterPacker/images/pink.png +0 -0
- package/PosterPacker/images/purple.png +0 -0
- package/PosterPacker/images/red.png +0 -0
- package/PosterPacker/images/right.png +0 -0
- package/PosterPacker/images/yellowGreen.png +0 -0
- package/PosterPacker/tools/geniePakcer/Genie.vue +686 -0
- package/PosterPacker/tools/geniePakcer/genieBottom.glsl +49 -0
- package/PosterPacker/tools/geniePakcer/genieLeft.glsl +50 -0
- package/PosterPacker/tools/geniePakcer/genieRight.glsl +57 -0
- package/PosterPacker/tools/geniePakcer/genieTop.glsl +50 -0
- package/PosterPacker/tools/particlePacker/Particle.vue +71 -0
- package/PosterPacker/tools/vortexPacker/Vortex.vue +135 -0
- package/PosterPacker/tools/vortexPacker/vortex.glsl +37 -0
- package/Preload/App.vue +1 -1
- package/SceneTransition/JsvSceneTransition.vue +30 -42
- package/ScrollBoxTest/App.vue +35 -86
- package/ScrollBoxTest/ClipBar.vue +154 -0
- package/ScrollBoxTest/DrawCircle.ts +25 -0
- package/ScrollBoxTest/NinePatchBar.vue +188 -0
- package/ScrollBoxTest/NoBackgroundBar.vue +125 -0
- package/ScrollBoxTest/SizeDivBar.vue +139 -0
- package/SprayMove/App.vue +75 -0
- package/SprayMove/SprayMove.vue +173 -0
- package/SprayView/App.vue +8 -9
- package/TestNativeSharedView/App.vue +6 -4
- package/TextShadowDemo/App.vue +3 -3
- package/TextureAnimation/App.vue +244 -148
- package/TextureAnimation/App2.vue +66 -14
- package/TextureAnimation/assets/blackWhiteTurntable.png +0 -0
- package/TextureAnimation/assets/circleHaloMask.png +0 -0
- package/TombSweepingDayTest/Raining/Rain.vue +8 -8
- package/TouchWidget/App.vue +79 -40
- package/TouchWidget/Item.vue +15 -3
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/MetroWidgetDemos/RefreshDemo/data.js +0 -16
- package/TextureAnimation/assets/mask.png +0 -0
- package/TextureAnimation/assets/php.jpg +0 -0
- package/TouchSample/App.vue +0 -136
- package/TouchSample/Item.vue +0 -102
- package/TouchSample/MetroWidgetHorizontal.vue +0 -144
- package/TouchSample/MetroWidgetVertical.vue +0 -144
- package/TouchSample/TouchContainerHorizontal.vue +0 -160
- package/TouchSample/TouchContainerVertical.vue +0 -160
- package/TouchSample/data.js +0 -81
- /package/TextureAnimation/assets/{php2.png → borderOpacity.png} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
JsvFlexDiv,
|
|
7
7
|
VERTICAL,
|
|
8
8
|
JsvScrollBox,
|
|
9
|
-
|
|
9
|
+
ScrollBoxStyle,
|
|
10
10
|
} from "jsview";
|
|
11
11
|
|
|
12
12
|
const props = defineProps({
|
|
@@ -48,7 +48,7 @@ const onAction = {
|
|
|
48
48
|
case 38:
|
|
49
49
|
if (textY !== 0) {
|
|
50
50
|
text_y = textY + props.step >= 0 ? 0 : textY + props.step;
|
|
51
|
-
|
|
51
|
+
slideToYByKey(text_y);
|
|
52
52
|
}
|
|
53
53
|
break;
|
|
54
54
|
case 40:
|
|
@@ -57,7 +57,7 @@ const onAction = {
|
|
|
57
57
|
textY - props.step <= props.style.height - textTotalHeight
|
|
58
58
|
? props.style.height - textTotalHeight
|
|
59
59
|
: textY - props.step;
|
|
60
|
-
|
|
60
|
+
slideToYByKey(text_y);
|
|
61
61
|
} else {
|
|
62
62
|
focusHub.setFocus("button");
|
|
63
63
|
}
|
|
@@ -73,35 +73,37 @@ const onAction = {
|
|
|
73
73
|
},
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
function
|
|
76
|
+
function slideToYByKey(newY) {
|
|
77
77
|
// 使用新的Y来调整ScrollBox的显示位置
|
|
78
78
|
rJsvScrollBox.value.updatePercent(
|
|
79
79
|
-newY / (textTotalHeight - props.style.height)
|
|
80
80
|
);
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
recordTextY(newY);
|
|
83
|
+
|
|
84
|
+
// 不再直接更新右边进度条的进度
|
|
85
|
+
// 将由 JsvScrollBox 的syncWith机制来同步
|
|
86
|
+
// 注意: 目前这个机制在PC上没有模拟,
|
|
87
|
+
// 如果PC上也需要看到同步效果,则可通过 window.JsView 是否存在来识别非盒子情况,此时主动改变bar的top
|
|
84
88
|
}
|
|
85
89
|
|
|
86
|
-
function
|
|
90
|
+
function recordTextY(newY) {
|
|
91
|
+
// 记录text Y,为为下次按键的基准坐标
|
|
87
92
|
textY = newY;
|
|
88
|
-
|
|
89
|
-
scrollY.value =
|
|
90
|
-
(-newY / (textTotalHeight - props.style.height)) *
|
|
91
|
-
(props.scrollStyle.height - props.scrollBlockStyle.height);
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
onMounted(() => {
|
|
95
96
|
rootRef.value.requestFocus();
|
|
97
|
+
|
|
98
|
+
// 检测滚动触控触发的移动,
|
|
99
|
+
// 当 updatePercent 调用后如果移动距离大于阈值也会回调
|
|
96
100
|
rJsvScrollBox.value.setSensor((percent, x, y) => {
|
|
97
101
|
let newY = Math.floor(y);
|
|
98
102
|
console.log(
|
|
99
|
-
`onProgress dragged percent=${percent}
|
|
100
|
-
x=${Math.floor(x)} \
|
|
101
|
-
y=${newY}`
|
|
103
|
+
`onProgress dragged percent=${percent} x=${Math.floor(x)} y=${newY}`
|
|
102
104
|
);
|
|
103
|
-
|
|
104
|
-
}, 15);
|
|
105
|
+
recordTextY(newY);
|
|
106
|
+
}, 15 /* 每动15px才接收一次通知,减少js被调用的频率,从而减小对性能的影响 */);
|
|
105
107
|
});
|
|
106
108
|
</script>
|
|
107
109
|
|
|
@@ -110,12 +112,14 @@ y=${newY}`
|
|
|
110
112
|
<div :style="{ overflow: 'hidden', ...style }">
|
|
111
113
|
<jsv-scroll-box
|
|
112
114
|
ref="rJsvScrollBox"
|
|
115
|
+
linkName="ScrollBoxTextArea"
|
|
116
|
+
syncWith="ScrollBarTextArea"
|
|
113
117
|
:style="{
|
|
114
118
|
width: style.width,
|
|
115
119
|
height: style.height,
|
|
116
120
|
}"
|
|
117
121
|
:direction="VERTICAL"
|
|
118
|
-
:mode="
|
|
122
|
+
:mode="ScrollBoxStyle.DrawerMode"
|
|
119
123
|
:enableFling="true"
|
|
120
124
|
:sliderSize="{
|
|
121
125
|
height: rScrollHeight == 0 ? style.height : rScrollHeight,
|
|
@@ -235,10 +239,6 @@ y=${newY}`
|
|
|
235
239
|
</template>
|
|
236
240
|
</jsv-scroll-box>
|
|
237
241
|
</div>
|
|
238
|
-
<Scroll
|
|
239
|
-
:top="scrollY"
|
|
240
|
-
:scrollStyle="scrollStyle"
|
|
241
|
-
:scrollBlockStyle="scrollBlockStyle"
|
|
242
|
-
/>
|
|
242
|
+
<Scroll :scrollStyle="scrollStyle" :scrollBlockStyle="scrollBlockStyle" />
|
|
243
243
|
</jsv-focus-block>
|
|
244
244
|
</template>
|
package/LongText/Scroll.vue
CHANGED
|
@@ -1,14 +1,33 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { VERTICAL, JsvScrollBox, SeamlessSlide, ScrollBoxStyle } from "jsview";
|
|
3
|
+
|
|
4
|
+
let rProps = defineProps({
|
|
3
5
|
scrollStyle: Object,
|
|
4
|
-
top: Number,
|
|
5
6
|
scrollBlockStyle: Object,
|
|
6
7
|
});
|
|
8
|
+
|
|
9
|
+
let { left: cScrollLeft, ...cScrollSubStyle } = rProps.scrollStyle as any;
|
|
7
10
|
</script>
|
|
8
11
|
<template>
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
<jsv-scroll-box
|
|
13
|
+
linkName="ScrollBarTextArea"
|
|
14
|
+
syncWith="ScrollBoxTextArea"
|
|
15
|
+
:style="{
|
|
16
|
+
left: cScrollLeft,
|
|
17
|
+
width: cScrollSubStyle.width,
|
|
18
|
+
height: cScrollSubStyle.height,
|
|
19
|
+
}"
|
|
20
|
+
:direction="VERTICAL"
|
|
21
|
+
:mode="ScrollBoxStyle.PinMode"
|
|
22
|
+
:sliderSize="{
|
|
23
|
+
height: (rProps.scrollBlockStyle as any).height,
|
|
24
|
+
}"
|
|
25
|
+
>
|
|
26
|
+
<template #FixedBox>
|
|
27
|
+
<div :style="{ ...cScrollSubStyle }" />
|
|
28
|
+
</template>
|
|
29
|
+
<template #SliderBox>
|
|
30
|
+
<div :style="{ ...rProps.scrollBlockStyle }" />
|
|
31
|
+
</template>
|
|
32
|
+
</jsv-scroll-box>
|
|
33
|
+
</template>
|
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
MetroWidget,
|
|
4
|
+
VERTICAL,
|
|
5
|
+
HORIZONTAL,
|
|
6
|
+
useFocusHub,
|
|
7
|
+
EdgeDirection,
|
|
8
|
+
} from "jsview";
|
|
3
9
|
import Item from "./Item.vue";
|
|
10
|
+
import ControlItem from "./ControlItem.vue";
|
|
4
11
|
import { onMounted, shallowRef } from "vue";
|
|
5
12
|
import { useRouter } from "vue-router";
|
|
6
|
-
import
|
|
13
|
+
import imageUrl from "./assets/imageList.json";
|
|
7
14
|
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
15
|
+
let freshToken = 0;
|
|
16
|
+
const prepareData = (data, w, h, start, end, contentPrefix = "test") => {
|
|
17
|
+
for (let i = start; i < end; ++i) {
|
|
18
|
+
data.push({
|
|
19
|
+
jsvKey: i + "_" + freshToken,
|
|
20
|
+
width: w,
|
|
21
|
+
height: h,
|
|
22
|
+
url: imageUrl[i],
|
|
23
|
+
index: i,
|
|
24
|
+
content: contentPrefix + "_" + i,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const data1 = [];
|
|
30
|
+
const data2 = [];
|
|
31
|
+
prepareData(data2, 200, 200, 0, 40);
|
|
32
|
+
const data3 = [];
|
|
33
|
+
prepareData(data3, 200, 200, 0, 60);
|
|
11
34
|
|
|
12
35
|
const router = useRouter();
|
|
13
36
|
const focusHub = useFocusHub();
|
|
@@ -21,13 +44,6 @@ const measures = (item) => {
|
|
|
21
44
|
};
|
|
22
45
|
};
|
|
23
46
|
|
|
24
|
-
const onKeyDown = (ev) => {
|
|
25
|
-
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
26
|
-
router.go(-1);
|
|
27
|
-
}
|
|
28
|
-
return true;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
47
|
let curData = data1;
|
|
32
48
|
const provideData = () => {
|
|
33
49
|
return curData;
|
|
@@ -38,64 +54,164 @@ onMounted(() => {
|
|
|
38
54
|
setTimeout(() => {
|
|
39
55
|
curData = data2;
|
|
40
56
|
widgetRef.value.refreshData();
|
|
41
|
-
|
|
42
57
|
setTimeout(() => {
|
|
43
58
|
curData = data3;
|
|
44
59
|
widgetRef.value.refreshData();
|
|
45
|
-
},
|
|
46
|
-
},
|
|
60
|
+
}, 1000);
|
|
61
|
+
}, 1000);
|
|
47
62
|
});
|
|
48
63
|
|
|
49
64
|
const widgetRef = shallowRef();
|
|
65
|
+
const onEdge = (edgeInfo) => {
|
|
66
|
+
if (edgeInfo.direction == EdgeDirection.right) {
|
|
67
|
+
focusHub.setFocus("control");
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
//controller
|
|
72
|
+
const controlList = [
|
|
73
|
+
{
|
|
74
|
+
name: "追加",
|
|
75
|
+
callback: () => {
|
|
76
|
+
if (curData.length + 20 < imageUrl.length) {
|
|
77
|
+
prepareData(curData, 200, 200, curData.length, curData.length + 20);
|
|
78
|
+
widgetRef.value.refreshData();
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "全部替换",
|
|
84
|
+
callback: () => {
|
|
85
|
+
freshToken++;
|
|
86
|
+
const data = [];
|
|
87
|
+
prepareData(data, 200, 100, 0, 60);
|
|
88
|
+
curData = data;
|
|
89
|
+
widgetRef.value.refreshData();
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "刷新第5个item",
|
|
94
|
+
callback: () => {
|
|
95
|
+
if (curData.length > 5) {
|
|
96
|
+
freshToken++;
|
|
97
|
+
let oldItem = curData[5];
|
|
98
|
+
curData[5] = {
|
|
99
|
+
...oldItem,
|
|
100
|
+
jsvKey: 5 + "_" + freshToken,
|
|
101
|
+
content: Math.round(Math.random() * 100) + "",
|
|
102
|
+
};
|
|
103
|
+
widgetRef.value.refreshData();
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
// {
|
|
108
|
+
// name: "新数据旧id:不刷新",
|
|
109
|
+
// callback: () => {
|
|
110
|
+
// const data = [];
|
|
111
|
+
// prepareData(data, 200, 200, 0, curData.length);
|
|
112
|
+
// data.forEach((i, index) => {
|
|
113
|
+
// i.jsvKey = curData[index].jsvKey;
|
|
114
|
+
// });
|
|
115
|
+
// curData = data;
|
|
116
|
+
// widgetRef.value.refreshData();
|
|
117
|
+
// },
|
|
118
|
+
// },
|
|
119
|
+
{
|
|
120
|
+
name: "同尺寸新数据:刷新",
|
|
121
|
+
callback: () => {
|
|
122
|
+
freshToken++;
|
|
123
|
+
const data = [];
|
|
124
|
+
prepareData(data, 200, 200, 0, curData.length > 0 ? curData.length : 40);
|
|
125
|
+
curData = data;
|
|
126
|
+
widgetRef.value.refreshData();
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "刷新为空数据",
|
|
131
|
+
callback: () => {
|
|
132
|
+
freshToken++;
|
|
133
|
+
const data = [];
|
|
134
|
+
curData = data;
|
|
135
|
+
widgetRef.value.refreshData();
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
];
|
|
139
|
+
const controlWidgetMeasure = (data) => {
|
|
140
|
+
return {
|
|
141
|
+
width: 300,
|
|
142
|
+
height: 50,
|
|
143
|
+
marginBottom: 10,
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
const controlWidgetProvideData = () => {
|
|
147
|
+
return controlList;
|
|
148
|
+
};
|
|
149
|
+
const controlOnEdge = (edgeInfo) => {
|
|
150
|
+
if (edgeInfo.direction == EdgeDirection.left) {
|
|
151
|
+
focusHub.setFocus("myFocusWidget");
|
|
152
|
+
}
|
|
153
|
+
};
|
|
50
154
|
</script>
|
|
51
155
|
|
|
52
156
|
<template>
|
|
53
|
-
<
|
|
54
|
-
ref="focusNode"
|
|
157
|
+
<div
|
|
55
158
|
:style="{
|
|
56
159
|
width: 1920,
|
|
57
160
|
height: 1080,
|
|
58
161
|
backgroundColor: '#007788',
|
|
59
162
|
}"
|
|
60
|
-
|
|
163
|
+
></div>
|
|
164
|
+
<metro-widget
|
|
165
|
+
ref="widgetRef"
|
|
166
|
+
name="myFocusWidget"
|
|
167
|
+
:top="100"
|
|
168
|
+
:left="50"
|
|
169
|
+
:width="1000"
|
|
170
|
+
:height="550"
|
|
171
|
+
:direction="VERTICAL"
|
|
172
|
+
:provideData="provideData"
|
|
173
|
+
:measures="measures"
|
|
174
|
+
:padding="{ left: 50, right: 50, top: 50, bottom: 50 }"
|
|
175
|
+
:enableItemRenderBreak="true"
|
|
176
|
+
:onEdge="onEdge"
|
|
177
|
+
:placeHolderSetting="{
|
|
178
|
+
backgroundColor: 'rgba(78,105,127, 0.8)',
|
|
179
|
+
focusBackgroundColor: '#770088aa',
|
|
180
|
+
borderRadius: 10,
|
|
181
|
+
gap: 10,
|
|
182
|
+
}"
|
|
183
|
+
>
|
|
184
|
+
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
185
|
+
<item :data="data" :query="query" :onEdge="onEdge" :onAction="onAction" />
|
|
186
|
+
</template>
|
|
187
|
+
</metro-widget>
|
|
188
|
+
|
|
189
|
+
<metro-widget
|
|
190
|
+
name="control"
|
|
191
|
+
:left="1100"
|
|
192
|
+
:top="50"
|
|
193
|
+
:width="300"
|
|
194
|
+
:height="500"
|
|
195
|
+
:direction="HORIZONTAL"
|
|
196
|
+
:provideData="controlWidgetProvideData"
|
|
197
|
+
:measures="controlWidgetMeasure"
|
|
198
|
+
:onEdge="controlOnEdge"
|
|
199
|
+
>
|
|
200
|
+
<template #renderItem="{ data, onAction }">
|
|
201
|
+
<control-item :data="data" :onAction="onAction" />
|
|
202
|
+
</template>
|
|
203
|
+
</metro-widget>
|
|
204
|
+
|
|
205
|
+
<div
|
|
206
|
+
:style="{
|
|
207
|
+
left: 50,
|
|
208
|
+
top: 50,
|
|
209
|
+
width: 800,
|
|
210
|
+
height: 200,
|
|
211
|
+
color: '#FFFFFF',
|
|
212
|
+
fontSize: 30,
|
|
213
|
+
}"
|
|
61
214
|
>
|
|
62
|
-
|
|
63
|
-
ref="widgetRef"
|
|
64
|
-
name="myFocusWidget"
|
|
65
|
-
:top="100"
|
|
66
|
-
:left="50"
|
|
67
|
-
:width="1000"
|
|
68
|
-
:height="550"
|
|
69
|
-
:direction="VERTICAL"
|
|
70
|
-
:provideData="provideData"
|
|
71
|
-
:measures="measures"
|
|
72
|
-
:padding="{ left: 50, right: 50, top: 50, bottom: 50 }"
|
|
73
|
-
:enableItemRenderBreak="true"
|
|
74
|
-
:placeHolderSetting="{
|
|
75
|
-
backgroundColor: 'rgba(78,105,127, 0.8)',
|
|
76
|
-
focusBackgroundColor: '#770088aa',
|
|
77
|
-
borderRadius: 10,
|
|
78
|
-
gap: 10,
|
|
79
|
-
}"
|
|
80
|
-
>
|
|
81
|
-
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
82
|
-
<item
|
|
83
|
-
:data="data"
|
|
84
|
-
:query="query"
|
|
85
|
-
:onEdge="onEdge"
|
|
86
|
-
:onAction="onAction"
|
|
87
|
-
/>
|
|
88
|
-
</template>
|
|
89
|
-
</metro-widget>
|
|
90
|
-
</jsv-focus-block>
|
|
91
|
-
<div :style="{
|
|
92
|
-
left: 50,
|
|
93
|
-
top: 50,
|
|
94
|
-
width: 800,
|
|
95
|
-
height: 200,
|
|
96
|
-
color: '#FFFFFF',
|
|
97
|
-
fontSize: 30
|
|
98
|
-
}">
|
|
99
|
-
起来时会刷新两次数据, 看起来无闪烁即可
|
|
215
|
+
起来时先是无数据, 1s后有数据, 再1s后刷新, 无报错, 无闪烁即可
|
|
100
216
|
</div>
|
|
101
217
|
</template>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-02-06 10:19:42
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script setup>
|
|
7
|
+
import { ref } from "vue";
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
data: Object,
|
|
11
|
+
onAction: Object,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
let focused = ref(false);
|
|
15
|
+
|
|
16
|
+
const onFocus = () => {
|
|
17
|
+
focused.value = true;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const onBlur = () => {
|
|
21
|
+
focused.value = false;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const onClicked = () => {
|
|
25
|
+
props.data.callback();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
props.onAction.register("onFocus", onFocus);
|
|
29
|
+
props.onAction.register("onBlur", onBlur);
|
|
30
|
+
props.onAction.register("onClick", onClicked);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<div
|
|
35
|
+
:style="{
|
|
36
|
+
width: 300,
|
|
37
|
+
height: 50,
|
|
38
|
+
backgroundColor: focused ? '#444444' : '#778800',
|
|
39
|
+
fontSize: 30,
|
|
40
|
+
color: '#ffffff',
|
|
41
|
+
}"
|
|
42
|
+
>
|
|
43
|
+
{{ data.name }}
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @Description: file content
|
|
5
5
|
-->
|
|
6
6
|
<script setup>
|
|
7
|
-
import { ref } from "vue";
|
|
7
|
+
import { ref, onMounted } from "vue";
|
|
8
8
|
import { JsvPosterImage, JsvPosterDiv } from "jsview";
|
|
9
9
|
|
|
10
10
|
const props = defineProps({
|
|
@@ -31,6 +31,10 @@ const onClicked = () => {
|
|
|
31
31
|
props.onAction.register("onFocus", onFocus);
|
|
32
32
|
props.onAction.register("onBlur", onBlur);
|
|
33
33
|
props.onAction.register("onClick", onClicked);
|
|
34
|
+
|
|
35
|
+
onMounted(() => {
|
|
36
|
+
console.log("item mounted", props.data.index);
|
|
37
|
+
});
|
|
34
38
|
</script>
|
|
35
39
|
|
|
36
40
|
<template>
|
|
@@ -52,8 +56,7 @@ props.onAction.register("onClick", onClicked);
|
|
|
52
56
|
backgroundColor: '#770088',
|
|
53
57
|
borderRadius: 10,
|
|
54
58
|
}"
|
|
55
|
-
>
|
|
56
|
-
</div>
|
|
59
|
+
></div>
|
|
57
60
|
<div v-if="query.index % 2 == 0">
|
|
58
61
|
<jsv-poster-image
|
|
59
62
|
:style="{
|
|
@@ -112,5 +115,18 @@ props.onAction.register("onClick", onClicked);
|
|
|
112
115
|
{{ "div" }}
|
|
113
116
|
</div>
|
|
114
117
|
</div>
|
|
118
|
+
|
|
119
|
+
<div
|
|
120
|
+
:style="{
|
|
121
|
+
top: 50,
|
|
122
|
+
width: data.width,
|
|
123
|
+
height: 40,
|
|
124
|
+
backgroundColor: '#444444aa',
|
|
125
|
+
fontSize: 30,
|
|
126
|
+
color: '#ffffff',
|
|
127
|
+
}"
|
|
128
|
+
>
|
|
129
|
+
{{ data.content }}
|
|
130
|
+
</div>
|
|
115
131
|
</div>
|
|
116
|
-
</template>
|
|
132
|
+
</template>
|
|
@@ -7,95 +7,95 @@ export default [
|
|
|
7
7
|
{
|
|
8
8
|
name: "基础示例",
|
|
9
9
|
path: "/metroWidget/basic",
|
|
10
|
-
component: () => import("jsview-vue-samples/MetroWidgetDemos/basic/App.vue"),
|
|
10
|
+
component: () => import("@shijiu/jsview-vue-samples/MetroWidgetDemos/basic/App.vue"),
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
name: "direction",
|
|
14
14
|
path: "/metroWidget/direction",
|
|
15
|
-
component: () => import("jsview-vue-samples/MetroWidgetDemos/direction/App.vue"),
|
|
15
|
+
component: () => import("@shijiu/jsview-vue-samples/MetroWidgetDemos/direction/App.vue"),
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
name: "padding",
|
|
19
19
|
path: "/metroWidget/padding",
|
|
20
|
-
component: () => import("jsview-vue-samples/MetroWidgetDemos/padding/App.vue"),
|
|
20
|
+
component: () => import("@shijiu/jsview-vue-samples/MetroWidgetDemos/padding/App.vue"),
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
name: "slideSetting",
|
|
24
24
|
path: "/metroWidget/slideSetting",
|
|
25
|
-
component: () => import("jsview-vue-samples/MetroWidgetDemos/slideSetting/App.vue"),
|
|
25
|
+
component: () => import("@shijiu/jsview-vue-samples/MetroWidgetDemos/slideSetting/App.vue"),
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
name: "layoutType",
|
|
29
29
|
path: "/metroWidget/layoutType",
|
|
30
|
-
component: () => import("jsview-vue-samples/MetroWidgetDemos/layoutType/App.vue"),
|
|
30
|
+
component: () => import("@shijiu/jsview-vue-samples/MetroWidgetDemos/layoutType/App.vue"),
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
name: "嵌套(基础)",
|
|
34
34
|
path: "/metroWidget/focusableItemBasic",
|
|
35
|
-
component: () => import("jsview-vue-samples/MetroWidgetDemos/focusableItemBasic/App.vue"),
|
|
35
|
+
component: () => import("@shijiu/jsview-vue-samples/MetroWidgetDemos/focusableItemBasic/App.vue"),
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
name: "嵌套(混合)",
|
|
39
39
|
path: "/metroWidget/focusableItemMix",
|
|
40
|
-
component: () => import("jsview-vue-samples/MetroWidgetDemos/focusableItemMix/App.vue"),
|
|
40
|
+
component: () => import("@shijiu/jsview-vue-samples/MetroWidgetDemos/focusableItemMix/App.vue"),
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
name: "嵌套(MetroWidget)",
|
|
44
44
|
path: "/metroWidget/focusableItemMetroWidget",
|
|
45
|
-
component: () => import("jsview-vue-samples/MetroWidgetDemos/focusableItemMetroWidget/App.vue"),
|
|
45
|
+
component: () => import("@shijiu/jsview-vue-samples/MetroWidgetDemos/focusableItemMetroWidget/App.vue"),
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
name: "乒乓模式",
|
|
49
49
|
path: "/metroWidget/PingPong",
|
|
50
50
|
component: () =>
|
|
51
|
-
import("jsview-vue-samples/MetroWidgetDemos/PingPong/App.vue"),
|
|
51
|
+
import("@shijiu/jsview-vue-samples/MetroWidgetDemos/PingPong/App.vue"),
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
name: "性能测试",
|
|
55
55
|
path: "/metroWidget/PerformanceTest",
|
|
56
56
|
component: () =>
|
|
57
|
-
import("jsview-vue-samples/MetroWidgetDemos/PerformanceTest/App.vue"),
|
|
57
|
+
import("@shijiu/jsview-vue-samples/MetroWidgetDemos/PerformanceTest/App.vue"),
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
name: "骨架图",
|
|
61
61
|
path: "/metroWidget/SkeletonDiagram",
|
|
62
62
|
component: () =>
|
|
63
|
-
import("jsview-vue-samples/MetroWidgetDemos/SkeletonDiagram/App.vue"),
|
|
63
|
+
import("@shijiu/jsview-vue-samples/MetroWidgetDemos/SkeletonDiagram/App.vue"),
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
name: ".9焦点页面",
|
|
67
67
|
path: "/metroWidget/ninePatchFocusPage",
|
|
68
68
|
component: () =>
|
|
69
|
-
import("jsview-vue-samples/MetroWidgetDemos/ninePatchFocusPage/App.vue"),
|
|
69
|
+
import("@shijiu/jsview-vue-samples/MetroWidgetDemos/ninePatchFocusPage/App.vue"),
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
name: "item尺寸更新",
|
|
73
73
|
path: "/metroWidget/itemSizeUpdate",
|
|
74
74
|
component: () =>
|
|
75
|
-
import("jsview-vue-samples/MetroWidgetDemos/itemSizeUpdate/App.vue"),
|
|
75
|
+
import("@shijiu/jsview-vue-samples/MetroWidgetDemos/itemSizeUpdate/App.vue"),
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
name: "三层嵌套",
|
|
79
79
|
path: "/metroWidget/TripleWidget",
|
|
80
80
|
component: () =>
|
|
81
|
-
import("jsview-vue-samples/MetroWidgetDemos/TripleWidget/App.vue"),
|
|
81
|
+
import("@shijiu/jsview-vue-samples/MetroWidgetDemos/TripleWidget/App.vue"),
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
name: "数据刷新demo",
|
|
85
85
|
path: "/metroWidget/RefreshDemo",
|
|
86
86
|
component: () =>
|
|
87
|
-
import("jsview-vue-samples/MetroWidgetDemos/RefreshDemo/App.vue"),
|
|
87
|
+
import("@shijiu/jsview-vue-samples/MetroWidgetDemos/RefreshDemo/App.vue"),
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
name: "剧集翻页",
|
|
91
91
|
path: "/metroWidget/SeamlessSlide",
|
|
92
92
|
component: () =>
|
|
93
|
-
import("jsview-vue-samples/MetroWidgetDemos/SeamlessSlide/App.vue"),
|
|
93
|
+
import("@shijiu/jsview-vue-samples/MetroWidgetDemos/SeamlessSlide/App.vue"),
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
name: "多item分段显示",
|
|
97
97
|
path: "/metroWidget/MassiveItems",
|
|
98
98
|
component: () =>
|
|
99
|
-
import("jsview-vue-samples/MetroWidgetDemos/MassiveItems/App.vue"),
|
|
99
|
+
import("@shijiu/jsview-vue-samples/MetroWidgetDemos/MassiveItems/App.vue"),
|
|
100
100
|
},
|
|
101
101
|
]
|
package/MindMap/App.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { onMounted } from "vue"
|
|
2
|
+
import { onMounted, shallowRef } from "vue"
|
|
3
3
|
import { JsvMindMap, useFocusHub } from "jsview";
|
|
4
4
|
import Item from "./Item.vue";
|
|
5
5
|
import { data } from "./data"
|
|
@@ -9,6 +9,7 @@ const provideData = () => {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
const focusHub = useFocusHub();
|
|
12
|
+
const widgetRef = shallowRef();
|
|
12
13
|
|
|
13
14
|
const lineColor = {
|
|
14
15
|
0: "#ff0000",
|
|
@@ -31,20 +32,27 @@ const formatNode = (item, depth) => {
|
|
|
31
32
|
backgroundColor: lineColor[depth],
|
|
32
33
|
lineWidth: 3,
|
|
33
34
|
},
|
|
35
|
+
enableTap: true,
|
|
34
36
|
};
|
|
35
37
|
};
|
|
36
38
|
const onEdge = (info) => {
|
|
37
39
|
console.log("onEdge ", info);
|
|
38
40
|
};
|
|
39
41
|
|
|
42
|
+
function onMove(pos) {
|
|
43
|
+
console.log("onMove", pos)
|
|
44
|
+
}
|
|
45
|
+
|
|
40
46
|
const componentName = "mindMapDemo";
|
|
41
47
|
onMounted(() => {
|
|
42
48
|
focusHub.setFocus(componentName);
|
|
49
|
+
widgetRef.value?.setSensor(onMove)
|
|
43
50
|
})
|
|
44
51
|
</script>
|
|
45
52
|
|
|
46
53
|
<template>
|
|
47
54
|
<jsv-mind-map
|
|
55
|
+
ref="widgetRef"
|
|
48
56
|
:name="componentName"
|
|
49
57
|
:left="200"
|
|
50
58
|
:top="100"
|
|
@@ -53,6 +61,7 @@ onMounted(() => {
|
|
|
53
61
|
:formatNode="formatNode"
|
|
54
62
|
:provideData="provideData"
|
|
55
63
|
:onEdge="onEdge"
|
|
64
|
+
:touchFlag="1"
|
|
56
65
|
>
|
|
57
66
|
<template v-slot="{ data, onAction, handler }">
|
|
58
67
|
<item :data="data" :onAction="onAction" :handler="handler"></item>
|