@shijiu/jsview-vue-samples 2.2.201 → 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 +0 -1
- package/CoupletsTest/widget/Fireworks/Fireworks.vue +0 -2
- package/CustomShader/App.vue +30 -13
- package/CustomShader/pageFlip.glsl +3 -2
- package/DemoHomepage/App.vue +14 -5
- package/DemoHomepage/components/Item.vue +23 -12
- package/DemoHomepage/index.d.ts +5 -2
- package/DemoHomepage/router.js +97 -74
- 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/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/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/Input/App.vue +184 -97
- package/Input/InputPanel.vue +98 -82
- package/LatexFormula/App.vue +97 -10
- 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/ScrollBoxTest/ClipBar.vue +1 -0
- package/ScrollBoxTest/NinePatchBar.vue +1 -0
- package/ScrollBoxTest/SizeDivBar.vue +1 -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/TouchWidget/App.vue +79 -40
- package/TouchWidget/Item.vue +15 -3
- package/index.d.ts +1 -1
- package/package.json +1 -1
- 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
package/Input/App.vue
CHANGED
|
@@ -9,112 +9,199 @@
|
|
|
9
9
|
import { InputType, EdgeDirection, useFocusHub } from "jsview";
|
|
10
10
|
import InputPanel from "./InputPanel.vue";
|
|
11
11
|
import { useRouter } from "vue-router";
|
|
12
|
-
import { shallowRef } from "vue"
|
|
12
|
+
import { shallowRef } from "vue";
|
|
13
13
|
const router = useRouter();
|
|
14
|
-
let focusNode = shallowRef(null)
|
|
15
|
-
const name = "/input"
|
|
16
|
-
const focusHub = useFocusHub()
|
|
14
|
+
let focusNode = shallowRef(null);
|
|
15
|
+
const name = "/input";
|
|
16
|
+
const focusHub = useFocusHub();
|
|
17
17
|
|
|
18
18
|
const _onKeyDown = (ev) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
19
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
20
|
+
router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const focus_name_list = [
|
|
26
|
+
name + "/normal-left",
|
|
27
|
+
name + "/normal-right",
|
|
28
|
+
name + "/password",
|
|
29
|
+
name + "/number",
|
|
30
|
+
];
|
|
31
|
+
|
|
24
32
|
const _onFocus = () => {
|
|
25
|
-
|
|
26
|
-
}
|
|
33
|
+
focusHub.setFocus(focus_name_list[0]);
|
|
34
|
+
};
|
|
35
|
+
const _panel0OnEdge = (edgeInfo) => {
|
|
36
|
+
// 自己为0
|
|
37
|
+
if (edgeInfo.direction == EdgeDirection.right) {
|
|
38
|
+
focusHub.setFocus(focus_name_list[1]);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
27
41
|
const _panel1OnEdge = (edgeInfo) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
42
|
+
// 自己为1
|
|
43
|
+
if (edgeInfo.direction == EdgeDirection.left) {
|
|
44
|
+
focusHub.setFocus(focus_name_list[0]);
|
|
45
|
+
} else if (edgeInfo.direction == EdgeDirection.right) {
|
|
46
|
+
focusHub.setFocus(focus_name_list[2]);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
32
49
|
const _panel2OnEdge = (edgeInfo) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
50
|
+
// 自己为2
|
|
51
|
+
if (edgeInfo.direction == EdgeDirection.left) {
|
|
52
|
+
focusHub.setFocus(focus_name_list[1]);
|
|
53
|
+
} else if (edgeInfo.direction == EdgeDirection.right) {
|
|
54
|
+
focusHub.setFocus(focus_name_list[3]);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
39
57
|
const _panel3OnEdge = (edgeInfo) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
58
|
+
// 自己为3
|
|
59
|
+
if (edgeInfo.direction == EdgeDirection.left) {
|
|
60
|
+
focusHub.setFocus(focus_name_list[2]);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
46
63
|
</script>
|
|
47
64
|
|
|
48
65
|
<template>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
<jsv-focus-block
|
|
67
|
+
ref="focusNode"
|
|
68
|
+
autoFocus
|
|
69
|
+
:onAction="{
|
|
70
|
+
onKeyDown: _onKeyDown,
|
|
71
|
+
onFocus: _onFocus,
|
|
72
|
+
}"
|
|
73
|
+
:style="{
|
|
74
|
+
width: 1920,
|
|
75
|
+
height: 1080,
|
|
76
|
+
backgroundColor: '#007788',
|
|
77
|
+
}"
|
|
78
|
+
>
|
|
79
|
+
<div
|
|
80
|
+
:style="{
|
|
81
|
+
top: 100,
|
|
82
|
+
left: 100,
|
|
83
|
+
}"
|
|
84
|
+
>
|
|
85
|
+
<div
|
|
86
|
+
:style="{
|
|
87
|
+
width: 300,
|
|
88
|
+
height: 50,
|
|
89
|
+
lineHeight: 50,
|
|
90
|
+
textAlign: 'center',
|
|
91
|
+
fontSize: 30,
|
|
92
|
+
}"
|
|
93
|
+
>
|
|
94
|
+
文字输入-左对齐
|
|
95
|
+
</div>
|
|
96
|
+
<div
|
|
97
|
+
:style="{
|
|
98
|
+
top: 100,
|
|
99
|
+
}"
|
|
100
|
+
>
|
|
101
|
+
<input-panel
|
|
102
|
+
:name="name + '/normal-left'"
|
|
103
|
+
:type="InputType.TEXT"
|
|
104
|
+
textAlign="left"
|
|
105
|
+
placeholder="请输入"
|
|
106
|
+
:onEdge="_panel0OnEdge"
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<div
|
|
112
|
+
:style="{
|
|
113
|
+
top: 100,
|
|
114
|
+
left: 360,
|
|
115
|
+
}"
|
|
116
|
+
>
|
|
117
|
+
<div
|
|
118
|
+
:style="{
|
|
119
|
+
width: 300,
|
|
120
|
+
height: 50,
|
|
121
|
+
lineHeight: 50,
|
|
122
|
+
textAlign: 'center',
|
|
123
|
+
fontSize: 30,
|
|
124
|
+
}"
|
|
125
|
+
>
|
|
126
|
+
文字输入-右对齐
|
|
127
|
+
</div>
|
|
128
|
+
<div
|
|
129
|
+
:style="{
|
|
130
|
+
top: 100,
|
|
131
|
+
}"
|
|
132
|
+
>
|
|
133
|
+
<input-panel
|
|
134
|
+
:name="name + '/normal-right'"
|
|
135
|
+
:type="InputType.TEXT"
|
|
136
|
+
textAlign="right"
|
|
137
|
+
placeholder="请输入"
|
|
138
|
+
:onEdge="_panel1OnEdge"
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
77
142
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
143
|
+
<div
|
|
144
|
+
:style="{
|
|
145
|
+
top: 100,
|
|
146
|
+
left: 630,
|
|
147
|
+
}"
|
|
148
|
+
>
|
|
149
|
+
<div
|
|
150
|
+
:style="{
|
|
151
|
+
width: 300,
|
|
152
|
+
height: 50,
|
|
153
|
+
lineHeight: 50,
|
|
154
|
+
textAlign: 'center',
|
|
155
|
+
fontSize: 30,
|
|
156
|
+
}"
|
|
157
|
+
>
|
|
158
|
+
密码输入-右对齐
|
|
159
|
+
</div>
|
|
160
|
+
<div
|
|
161
|
+
:style="{
|
|
162
|
+
top: 100,
|
|
163
|
+
}"
|
|
164
|
+
>
|
|
165
|
+
<input-panel
|
|
166
|
+
:name="name + '/password'"
|
|
167
|
+
:type="InputType.PASSWORD"
|
|
168
|
+
textAlign="right"
|
|
169
|
+
placeholder="请输入"
|
|
170
|
+
:onEdge="_panel2OnEdge"
|
|
171
|
+
/>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
98
174
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
175
|
+
<div
|
|
176
|
+
:style="{
|
|
177
|
+
top: 100,
|
|
178
|
+
left: 900,
|
|
179
|
+
}"
|
|
180
|
+
>
|
|
181
|
+
<div
|
|
182
|
+
:style="{
|
|
183
|
+
width: 300,
|
|
184
|
+
height: 50,
|
|
185
|
+
lineHeight: 50,
|
|
186
|
+
textAlign: 'center',
|
|
187
|
+
fontSize: 30,
|
|
188
|
+
}"
|
|
189
|
+
>
|
|
190
|
+
数字输入-右对齐
|
|
191
|
+
</div>
|
|
192
|
+
<div
|
|
193
|
+
:style="{
|
|
194
|
+
top: 100,
|
|
195
|
+
}"
|
|
196
|
+
>
|
|
197
|
+
<input-panel
|
|
198
|
+
:name="name + '/number'"
|
|
199
|
+
:type="InputType.NUMBER"
|
|
200
|
+
textAlign="right"
|
|
201
|
+
placeholder="请输入"
|
|
202
|
+
:onEdge="_panel3OnEdge"
|
|
203
|
+
/>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
</jsv-focus-block>
|
|
207
|
+
</template>
|
package/Input/InputPanel.vue
CHANGED
|
@@ -8,100 +8,116 @@
|
|
|
8
8
|
<script setup>
|
|
9
9
|
import FullKeyboard from "./FullKeyboard.vue";
|
|
10
10
|
import { EdgeDirection, JsvInput, useFocusHub } from "jsview";
|
|
11
|
-
import { shallowRef} from "vue";
|
|
11
|
+
import { shallowRef } from "vue";
|
|
12
12
|
|
|
13
13
|
const blurColor = "#AAAAAA";
|
|
14
14
|
const focusColor = "#FFFF00";
|
|
15
|
-
let focusNode = shallowRef(null)
|
|
16
|
-
let input=shallowRef(null)
|
|
17
|
-
let showCursor = shallowRef(false)
|
|
18
|
-
const focusHub = useFocusHub()
|
|
19
|
-
let cursorColor = shallowRef(blurColor)
|
|
15
|
+
let focusNode = shallowRef(null);
|
|
16
|
+
let input = shallowRef(null);
|
|
17
|
+
let showCursor = shallowRef(false);
|
|
18
|
+
const focusHub = useFocusHub();
|
|
19
|
+
let cursorColor = shallowRef(blurColor);
|
|
20
20
|
const props = defineProps({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})
|
|
21
|
+
name: String,
|
|
22
|
+
type: Number,
|
|
23
|
+
textAlign: String,
|
|
24
|
+
placeHolder: String,
|
|
25
|
+
onEdge: Function,
|
|
26
|
+
});
|
|
27
27
|
const _onFocus = () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
28
|
+
showCursor.value = true;
|
|
29
|
+
cursorColor.value = blurColor;
|
|
30
|
+
focusHub.setFocus(`${props.name}/keyboard`);
|
|
31
|
+
};
|
|
32
32
|
const _onBlur = () => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
33
|
+
showCursor.value = false;
|
|
34
|
+
cursorColor.value = blurColor;
|
|
35
|
+
};
|
|
36
36
|
const _keyboardOnClick = (item) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
37
|
+
const char = item.content;
|
|
38
|
+
if (char === "删除") {
|
|
39
|
+
input.value?.delete();
|
|
40
|
+
} else if (char === "清空") {
|
|
41
|
+
input.value?.clear();
|
|
42
|
+
} else {
|
|
43
|
+
input.value?.add(char);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
46
|
const _keyboardOnEdge = (edgeInfo) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
47
|
+
if (edgeInfo.direction === EdgeDirection.top) {
|
|
48
|
+
focusHub.setFocus(`${props.name}/etext`);
|
|
49
|
+
cursorColor.value = focusColor;
|
|
50
|
+
} else {
|
|
51
|
+
props.onEdge?.(edgeInfo);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
54
|
const _onTextChange = (str) => {
|
|
55
|
-
|
|
56
|
-
}
|
|
55
|
+
console.log(props.name + " text change:", str);
|
|
56
|
+
};
|
|
57
57
|
const _onTextOverflow = () => {
|
|
58
|
-
|
|
59
|
-
}
|
|
58
|
+
console.log(props.name + " text overflow.");
|
|
59
|
+
};
|
|
60
|
+
const _onBackKey = (isUp) => {
|
|
61
|
+
return true; // 无论是key-down还是key-up都consume,防止软键盘有时候返回会吐出导致界面回退的问题
|
|
62
|
+
};
|
|
60
63
|
const _inputOnEdge = (edgeInfo) => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
64
|
+
if (edgeInfo.direction === EdgeDirection.bottom) {
|
|
65
|
+
focusHub.setFocus(`${props.name}/keyboard`);
|
|
66
|
+
cursorColor.value = blurColor;
|
|
67
|
+
} else {
|
|
68
|
+
props.onEdge?.(edgeInfo);
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
};
|
|
69
72
|
</script>
|
|
70
73
|
|
|
71
74
|
<template>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
75
|
+
<jsv-focus-block
|
|
76
|
+
:name="props.name"
|
|
77
|
+
ref="focusNode"
|
|
78
|
+
:onAction="{
|
|
79
|
+
onFocus: _onFocus,
|
|
80
|
+
onBlur: _onBlur,
|
|
81
|
+
}"
|
|
82
|
+
>
|
|
83
|
+
<div
|
|
84
|
+
:style="{
|
|
85
|
+
left: 50,
|
|
86
|
+
top: 50,
|
|
87
|
+
width: 150,
|
|
88
|
+
height: 40,
|
|
89
|
+
backgroundColor: '#33334f',
|
|
90
|
+
}"
|
|
91
|
+
/>
|
|
92
|
+
<jsv-input
|
|
93
|
+
:name="`${props.name}/etext`"
|
|
94
|
+
ref="input"
|
|
95
|
+
:type="props.type"
|
|
96
|
+
:left="50"
|
|
97
|
+
:top="50"
|
|
98
|
+
:height="40"
|
|
99
|
+
:width="150"
|
|
100
|
+
:placeholder="props.placeHolder"
|
|
101
|
+
:cursorShow="showCursor"
|
|
102
|
+
:fontStyle="{
|
|
103
|
+
fontSize: 28,
|
|
104
|
+
color: '#ffff00',
|
|
105
|
+
textAlign: props.textAlign,
|
|
106
|
+
}"
|
|
107
|
+
:onEdge="_inputOnEdge"
|
|
108
|
+
:cursorWidth="2"
|
|
109
|
+
:onTextChange="_onTextChange"
|
|
110
|
+
:onTextOverflow="_onTextOverflow"
|
|
111
|
+
:cursorColor="cursorColor"
|
|
112
|
+
:onBackKey="_onBackKey"
|
|
113
|
+
/>
|
|
102
114
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
115
|
+
<div :style="{ top: 100 }">
|
|
116
|
+
<full-keyboard
|
|
117
|
+
:name="`${props.name}/keyboard`"
|
|
118
|
+
:onClick="_keyboardOnClick"
|
|
119
|
+
:onEdge="_keyboardOnEdge"
|
|
120
|
+
/>
|
|
121
|
+
</div>
|
|
122
|
+
</jsv-focus-block>
|
|
123
|
+
</template>
|
package/LatexFormula/App.vue
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref,
|
|
3
|
-
import { JsvLatex, globalLoadJsvLatexPlugin } from "jsview";
|
|
2
|
+
import { ref, computed } from "vue";
|
|
3
|
+
import { JsvLatex, globalLoadJsvLatexPlugin, processLatexStr } from "jsview";
|
|
4
4
|
|
|
5
5
|
globalLoadJsvLatexPlugin((status) => {
|
|
6
6
|
console.log("load JsvLatex plugin status", status);
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
const stringList = [
|
|
10
|
+
{
|
|
11
|
+
width: 800,
|
|
12
|
+
str: `\\begin{array}{l}
|
|
13
|
+
\\textbf{测试}文字 \\forall\\varepsilon\\in\\mathbb{R}_+^*\\ \\exists\\eta>0\\ |x-x_0|\\leq\\eta\\Longrightarrow|f(x)-f(x_0)|\\leq\\varepsilon测试文字\\\\
|
|
11
14
|
测试文字\\det
|
|
12
15
|
\\begin{bmatrix}
|
|
13
16
|
a_{11}&a_{12}&\\cdots&a_{1n}\\\\
|
|
@@ -32,25 +35,109 @@ const latexStr = `\\begin{array}{l}
|
|
|
32
35
|
&= \\int_a^b \\sqrt{u'(t)^2\\,\\vec{r}_u\\cdot\\vec{r}_u + 2u'(t)v'(t)\\, \\vec{r}_u\\cdot
|
|
33
36
|
\\vec{r}_v+ v'(t)^2\\,\\vec{r}_v\\cdot\\vec{r}_v}\\,\\,\\, dt.
|
|
34
37
|
\\end{array}\\\\
|
|
35
|
-
\\end{array}
|
|
38
|
+
\\end{array}`,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
width: 1100,
|
|
42
|
+
str: `要解这个方程 \\(x^2 + 2x + 1 = 9\\),我们首先将方程移项,得到:
|
|
36
43
|
|
|
37
|
-
|
|
44
|
+
\\[x^2 + 2x + 1 - 9 = 0\\]
|
|
45
|
+
|
|
46
|
+
简化后得到:
|
|
47
|
+
|
|
48
|
+
\\[x^2 + 2x - 8 = 0\\]
|
|
49
|
+
|
|
50
|
+
在这个方程中,\\(a = 1\\), \\(b = 2\\), \\(c = -8\\)。代入求根公式:
|
|
51
|
+
|
|
52
|
+
\\[x = \\frac{-2 \\pm \\sqrt{2^2 - 4 \\cdot 1 \\cdot (-8)}}{2 \\cdot 1}\\]
|
|
53
|
+
|
|
54
|
+
\\[x = \\frac{-2 \\pm \\sqrt{4 + 32}}{2}\\]
|
|
55
|
+
|
|
56
|
+
\\[x = \\frac{-2 \\pm \\sqrt{36}}{2}\\]
|
|
57
|
+
|
|
58
|
+
\\[x = \\frac{-2 \\pm 6}{2}\\]
|
|
59
|
+
这给出了两个解:
|
|
60
|
+
|
|
61
|
+
\\[x_1 = \\frac{-2 + 6}{2} = 2\\]
|
|
62
|
+
|
|
63
|
+
\\[x_2 = \\frac{-2 - 6}{2} = -4\\]
|
|
64
|
+
|
|
65
|
+
所以,方程 \\(x^2 + 2x + 1 = 9\\) 的解是 \\(x = 2\\) 和 \\(x = -4\\)。`,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
width: 1100,
|
|
69
|
+
str: `当然可以,这里有一个涉及正弦和余弦的三角函数问题:
|
|
70
|
+
|
|
71
|
+
在一个直角三角形中,一个角的正弦值是 \\(\\frac{3}{5}\\),余弦值是 \\(\\frac{4}{5}\\)。请计算这个角的正切值和余切值。
|
|
72
|
+
|
|
73
|
+
提示:正切值 \\(\\tan(\\theta)\\) 可以通过正弦和余弦的比值来计算,即 \\(\\tan(\\theta) = \\frac{\\sin(\\theta)}{\\cos(\\theta)}\\)。余切值 \\(\\cot(\\theta)\\) 是正切值的倒数,即 \\(\\cot(\\theta) = \\frac{1}{\\tan(\\theta)}\\)。
|
|
74
|
+
|
|
75
|
+
请计算这个角的正切值和余切值。
|
|
76
|
+
\\[ \\tan(\\theta) = 0.75 \\]
|
|
77
|
+
\\[ \\cot(\\theta) = 1.33333333 \\]
|
|
78
|
+
|
|
79
|
+
这个角的正切值是 \\(0.75\\),余切值是 \\(1.33333333\\)。`,
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
const dataIndex = ref(0);
|
|
83
|
+
const width = computed(() => {
|
|
84
|
+
return stringList[dataIndex.value].width;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const latexStr = computed(() => {
|
|
88
|
+
const s = stringList[dataIndex.value].str;
|
|
89
|
+
// return s.replaceAll(/(?<!\\\\)[\n]+/g, "\\\\");
|
|
90
|
+
return processLatexStr(s);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const onKeyDown = (ev) => {
|
|
94
|
+
switch (ev.keyCode) {
|
|
95
|
+
case 37:
|
|
96
|
+
dataIndex.value =
|
|
97
|
+
dataIndex.value > 0 ? dataIndex.value - 1 : stringList.length - 1;
|
|
98
|
+
return true;
|
|
99
|
+
case 39:
|
|
100
|
+
dataIndex.value =
|
|
101
|
+
dataIndex.value < stringList.length - 1 ? dataIndex.value + 1 : 0;
|
|
102
|
+
return true;
|
|
103
|
+
default:
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
38
107
|
</script>
|
|
39
108
|
<template>
|
|
40
|
-
<
|
|
109
|
+
<jsv-focus-block
|
|
110
|
+
autoFocus
|
|
111
|
+
:onAction="{
|
|
112
|
+
onKeyDown,
|
|
113
|
+
}"
|
|
41
114
|
:style="{
|
|
42
115
|
width: 1280,
|
|
43
116
|
height: 720,
|
|
44
117
|
backgroundColor: '#007788',
|
|
45
118
|
}"
|
|
46
|
-
></
|
|
119
|
+
></jsv-focus-block>
|
|
47
120
|
<jsv-latex
|
|
121
|
+
:key="dataIndex"
|
|
48
122
|
:latexStr="latexStr"
|
|
49
|
-
:
|
|
50
|
-
:
|
|
123
|
+
:top="20"
|
|
124
|
+
:left="20"
|
|
125
|
+
:width="width"
|
|
51
126
|
:fontSize="25"
|
|
52
127
|
color="#FFFFFF"
|
|
53
128
|
></jsv-latex>
|
|
129
|
+
<div
|
|
130
|
+
:style="{
|
|
131
|
+
width: 300,
|
|
132
|
+
height: 100,
|
|
133
|
+
left: 900,
|
|
134
|
+
top: 650,
|
|
135
|
+
color: '#ffffff',
|
|
136
|
+
fontSize: 30,
|
|
137
|
+
}"
|
|
138
|
+
>
|
|
139
|
+
按左右键切换内容
|
|
140
|
+
</div>
|
|
54
141
|
</template>
|
|
55
142
|
|
|
56
143
|
<style scoped>
|