@shijiu/jsview-vue-samples 2.1.6-alpha.0 → 2.1.23

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.
@@ -6,8 +6,8 @@
6
6
  * @Description: file content
7
7
  -->
8
8
  <script setup>
9
- import { shallowRef, onMounted } from "vue";
10
- import { JsvPreload, buildPreloadInfo, jJsvRuntimeBridge, JsvFocusBlock } from "jsview";
9
+ import { shallowRef, onMounted, onUnmounted } from "vue";
10
+ import { JsvPreload, buildPreloadInfo, jJsvRuntimeBridge, JsvFocusBlock, useFocusHub } from "jsview";
11
11
  import { useRouter } from "vue-router";
12
12
  import { setDataUrl, getDataUrl } from "../CommonUtils/ResourceData.js"
13
13
  import { getSearchQuery } from "../CommonUtils/getSearchQuery.js"
@@ -17,6 +17,10 @@ let backgroundImageUrl = shallowRef(null);
17
17
 
18
18
  let preloadInfo = shallowRef([]);
19
19
 
20
+ window.DebugFocusHub = useFocusHub();
21
+
22
+ const router = useRouter();
23
+
20
24
  let _onPreloadDone = () => {
21
25
  console.log("background load done");
22
26
  jJsvRuntimeBridge.notifyPageLoaded();
@@ -25,7 +29,6 @@ let _onPreloadDone = () => {
25
29
  const _OnKeyDown = (ev) => {
26
30
  // 结果默认传下来的返回键
27
31
  if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
28
- const router = useRouter();
29
32
  router?.go(-1); // 有router时,是从DemoHomepage进入,回退
30
33
  return true;
31
34
  }
@@ -33,6 +36,10 @@ const _OnKeyDown = (ev) => {
33
36
  return false;
34
37
  };
35
38
 
39
+ // 用于测试DemoHomepage在keep-alive状态下的更新问题
40
+ let testKeepAliveModeText = shallowRef(1);
41
+ let testKeepAliveTimer = -1;
42
+
36
43
  //解析url
37
44
  let query = getSearchQuery(window.location.href, undefined, 0)
38
45
  if (query.DemoResourceBase) {
@@ -49,12 +56,21 @@ onMounted(() => {
49
56
  "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/BackgroundLongmao.jpg";
50
57
  preloadInfo.value = [buildPreloadInfo(backgroundImageUrl.value)];
51
58
  }, 0);
59
+
60
+ console.log("start homepage interval");
61
+ testKeepAliveTimer = setInterval(()=>{
62
+ testKeepAliveModeText.value++;
63
+ }, 1000)
52
64
  });
53
- </script>
54
65
 
55
- <script>
56
- // 从App.vue导出router,解决因为App.vue先加载导致的useRouter返回null的问题。
57
- export { router } from "./router.js"
66
+ onUnmounted(()=>{
67
+ if (testKeepAliveTimer > 0) {
68
+ console.log("remove homepage interval");
69
+ clearInterval(testKeepAliveTimer);
70
+ testKeepAliveTimer = -1;
71
+ }
72
+ })
73
+
58
74
  </script>
59
75
 
60
76
  <template>
@@ -65,6 +81,9 @@ export { router } from "./router.js"
65
81
  height: 720,
66
82
  backgroundImage: backgroundImageUrl,
67
83
  }" />
84
+ <div class="TestKeepAliveDiv">
85
+ {{ "刷新:" + testKeepAliveModeText }}
86
+ </div>
68
87
  <jsv-focus-block :onAction="{
69
88
  onKeyDown: _OnKeyDown
70
89
  }">
@@ -78,4 +97,15 @@ export { router } from "./router.js"
78
97
  </div>
79
98
  </template>
80
99
 
81
- <style scoped></style>
100
+ <style scoped>
101
+ .TestKeepAliveDiv {
102
+ top: 60;
103
+ left: 30;
104
+ width: 200;
105
+ height: 30;
106
+ font-size: 20;
107
+ line-height: 30;
108
+ color: #eb20c6;
109
+ }
110
+
111
+ </style>
@@ -0,0 +1,5 @@
1
+ import App from './App.vue'
2
+
3
+ export * from "./router.js"
4
+
5
+ export default App
@@ -0,0 +1,5 @@
1
+ import App from './App.vue'
2
+
3
+ export * from "./router.js"
4
+
5
+ export default App
@@ -147,6 +147,11 @@ let routeList = [
147
147
  path: '/Operations/GrayDown',
148
148
  component: () => import('jsview-vue-samples/FilterDemo/App.vue'),
149
149
  },
150
+ {
151
+ name: '水波特效',
152
+ path: '/Operations/Ripple',
153
+ component: () => import('jsview-vue-samples/Ripple/App.vue'),
154
+ },
150
155
  {
151
156
  name: '预加载',
152
157
  path: '/feature/Preload',
package/Ripple/App.vue ADDED
@@ -0,0 +1,182 @@
1
+ <!--
2
+ * 【模块 export 内容】
3
+ * JsvFilterView:黑白滤镜组件
4
+ * props说明:
5
+ * width {int} 宽
6
+ * height {int} 高
7
+ * left {int} left位置
8
+ * top {int} top位置
9
+ * filterType {String} 滤镜设置:
10
+ * null: 无滤镜
11
+ * "gray-down": 黑白滤镜(公祭日滤镜)
12
+ -->
13
+ <script setup>
14
+ import { Forge, ForgeExtension } from "@shijiu/jsview/dom/jsv-forge-define";
15
+ import { shallowRef, ref } from "vue";
16
+ import { JsvRipple, JsvRippleShape } from "jsview";
17
+
18
+ import img from "../assets/jpegDemo.jpeg";
19
+
20
+ const rippleViewRef = shallowRef(null);
21
+
22
+ const imgUrl =
23
+ "https://qcast-image.oss-cn-qingdao.aliyuncs.com/demo_images/colorful-blocks.jpg";
24
+
25
+ const genSource = () => {
26
+ return [
27
+ Math.round(Math.random() * 800),
28
+ Math.round(Math.random() * 300),
29
+ Math.round(Math.random() * 60 + 20),
30
+ ];
31
+ };
32
+
33
+ const foucsIndex = ref(0);
34
+
35
+ const button1 = {
36
+ left: 300,
37
+ top: 300,
38
+ width: 200,
39
+ height: 100,
40
+ };
41
+ const button2 = {
42
+ left: 600,
43
+ top: 300,
44
+ width: 200,
45
+ height: 100,
46
+ };
47
+ const clamp = (min, max, num) => Math.min(Math.max(num, min), max);
48
+
49
+ let waveToken = -1;
50
+ const onKeyDown = (ev) => {
51
+ switch (ev.keyCode) {
52
+ case 13:
53
+ const b = foucsIndex.value == 0 ? button1 : button2;
54
+ rippleViewRef.value.addSource(
55
+ Math.round(b.left + b.width / 2), //波中心的x
56
+ Math.round(b.top + b.height / 2), // 波中心的y
57
+ 40, // 波的振幅
58
+ {
59
+ type: JsvRippleShape.RECTANGLE, // 波的类型, 圆角矩形波
60
+ width: 200, // 矩形宽
61
+ height: 100, //矩形高
62
+ radius: 45, // 圆角半径
63
+ },
64
+ {
65
+ timeDecay: 10, //时间衰减因子
66
+ distanceDecay: 50, // 距离衰减因子
67
+ speed: 100, // 波速 px/s
68
+ frequency: 8, // 频率 次/s
69
+ waveNum: 2, // 波的个数
70
+ }
71
+ );
72
+ break;
73
+ case 38:
74
+ const p = genSource();
75
+ rippleViewRef.value.addSource(
76
+ ...p,
77
+ {
78
+ type: JsvRippleShape.CIRCLE,
79
+ },
80
+ {
81
+ timeDecay: 3,
82
+ distanceDecay: 8,
83
+ speed: 100,
84
+ frequency: 8,
85
+ waveNum: 2,
86
+ }
87
+ );
88
+ break;
89
+ case 37:
90
+ foucsIndex.value = clamp(0, 1, foucsIndex.value - 1);
91
+ break;
92
+ case 39:
93
+ foucsIndex.value = clamp(0, 1, foucsIndex.value + 1);
94
+ break;
95
+ default:
96
+ break;
97
+ }
98
+ };
99
+ </script>
100
+
101
+ <template>
102
+ <jsv-focus-block
103
+ autoFocus
104
+ :onAction="{
105
+ onKeyDown,
106
+ }"
107
+ ></jsv-focus-block>
108
+ <jsv-ripple ref="rippleViewRef" :width="1280" :height="720">
109
+ <div
110
+ :style="{
111
+ width: 1280,
112
+ height: 720,
113
+ backgroundImage: `url(${imgUrl})`,
114
+ }"
115
+ ></div>
116
+ <div
117
+ :style="{
118
+ left: 50,
119
+ top: 250,
120
+ width: 200,
121
+ height: 200,
122
+ backgroundImage: `url(${imgUrl})`,
123
+ animation: 'test-anim 1s infinite',
124
+ }"
125
+ ></div>
126
+
127
+ <div
128
+ :style="{
129
+ left: 50,
130
+ top: 50,
131
+ width: 800,
132
+ height: 50,
133
+ backgroundColor: '#007788',
134
+ fontSize: 27,
135
+ lineHeight: 50,
136
+ color: '#FFFFFF',
137
+ textAlign: 'center',
138
+ }"
139
+ >
140
+ 按上键添加随机波纹, 最多同时存在5个
141
+ </div>
142
+
143
+ <div
144
+ :style="{
145
+ ...button1,
146
+ backgroundColor: '#007788',
147
+ borderRadius: 45,
148
+ fontSize: 23,
149
+ lineHeight: 50,
150
+ textAlign: 'center',
151
+ color: foucsIndex == 0 ? '#FF0000' : '#FFFFFF',
152
+ }"
153
+ >
154
+ 按键1
155
+ </div>
156
+
157
+ <div
158
+ :style="{
159
+ ...button2,
160
+ backgroundColor: '#007788',
161
+ borderRadius: 45,
162
+ fontSize: 23,
163
+ lineHeight: 50,
164
+ textAlign: 'center',
165
+ color: foucsIndex == 1 ? '#FF0000' : '#FFFFFF',
166
+ }"
167
+ >
168
+ 按键2
169
+ </div>
170
+ </jsv-ripple>
171
+ </template>
172
+
173
+ <style scoped>
174
+ @keyframes test-anim {
175
+ from {
176
+ transform: rotate3d(0, 0, 1, 0deg);
177
+ }
178
+ to {
179
+ transform: rotate3d(0, 0, 1, 360deg);
180
+ }
181
+ }
182
+ </style>
package/Swiper/App.vue CHANGED
@@ -115,6 +115,7 @@ onMounted(() => {
115
115
  :reverseSwipe="true"
116
116
  :dotSize="20"
117
117
  :disableLoopWhenFocus="true"
118
+ :smoothTranslate="true"
118
119
  >
119
120
  <template #itemView="{ dataIndex, focused }">
120
121
  <div
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import App, { router } from './DemoHomepage/App.vue'
1
+ import App, { router } from './DemoHomepage'
2
2
 
3
3
  export default App
4
4
  export { router }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview-vue-samples",
3
- "version": "2.1.6-alpha.0",
3
+ "version": "2.1.23",
4
4
  "license": "MIT",
5
5
  "repository": "system/jsview-framework",
6
6
  "author": "mengxk",