yh-hiprint 2.5.0 → 2.5.1
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/hiprintPreview.vue +2 -2
- package/index.js +29 -29
- package/package.json +2 -2
package/hiprintPreview.vue
CHANGED
|
@@ -20,13 +20,13 @@ import {hiprint} from 'yh-hiprint';
|
|
|
20
20
|
function getQuery() {
|
|
21
21
|
let query = {};
|
|
22
22
|
try {
|
|
23
|
-
|
|
23
|
+
location.hash
|
|
24
24
|
.split('?')[1]
|
|
25
25
|
.split('&')
|
|
26
26
|
.forEach((str) => {
|
|
27
27
|
let index = str.indexOf('=');
|
|
28
28
|
let key = str.substring(0, index);
|
|
29
|
-
let value = str.substring(index + 1);
|
|
29
|
+
let value = decodeURIComponent(str.substring(index + 1));
|
|
30
30
|
query[key] = value;
|
|
31
31
|
});
|
|
32
32
|
} catch (error) {
|
package/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
1
|
+
import './libs/jquery';
|
|
2
|
+
export {hiprint, defaultElementTypeProvider, print, print2, usePaper, useScale, useDataSource} from './hooks/useHiprint';
|
|
3
|
+
export {default as fontSize} from './font-size';
|
|
4
|
+
export {default as scale} from './scale';
|
|
5
|
+
export {default as zIndex} from './z-index';
|
|
6
|
+
export {default as panel} from './panel';
|
|
7
7
|
|
|
8
|
-
export function cLog
|
|
8
|
+
export function cLog(string, isError = false) {
|
|
9
9
|
if (isError) {
|
|
10
|
-
console.error(
|
|
10
|
+
console.error('%cyhHiprint:%c', 'font-size: 16px;font-weight: bold;color: #00ffff', 'font-size: 16px;font-weight: bold;color: #ccccc', string);
|
|
11
11
|
} else {
|
|
12
|
-
console.log(
|
|
12
|
+
console.log('%cyhHiprint%c ' + string, 'font-size: 18px;font-weight: bold;color: #61AFEF', 'font-size: 12px;color: #999');
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const hiprint = ({
|
|
16
|
+
const hiprint = ({code, params, data, isCustom}) => {
|
|
17
17
|
let height = document.documentElement.clientHeight;
|
|
18
18
|
let width = (document.documentElement.clientWidth - 1200) / 2;
|
|
19
19
|
// 转换数组
|
|
@@ -21,43 +21,43 @@ const hiprint = ({ code, params, data, isCustom }) => {
|
|
|
21
21
|
if (!Array.isArray(params)) {
|
|
22
22
|
paramData = [params];
|
|
23
23
|
}
|
|
24
|
-
let url =
|
|
24
|
+
let url = '/hiprint/#/preview?code=' + encodeURIComponent(code);
|
|
25
25
|
if (params) {
|
|
26
|
-
url += `¶ms=${JSON.stringify(paramData)}`;
|
|
26
|
+
url += `¶ms=${encodeURIComponent(JSON.stringify(paramData))}`;
|
|
27
27
|
}
|
|
28
28
|
if (data) {
|
|
29
|
-
url += `&data=${JSON.stringify(data)}`;
|
|
29
|
+
url += `&data=${encodeURIComponent(JSON.stringify(data))}`;
|
|
30
30
|
}
|
|
31
31
|
if (isCustom) {
|
|
32
|
-
url += `&isCustom=${isCustom ?
|
|
32
|
+
url += `&isCustom=${isCustom ? '1' : '0'}`;
|
|
33
33
|
}
|
|
34
|
-
let windowOpen = window.open(url,
|
|
34
|
+
let windowOpen = window.open(url, 'hiprintWindow', `height=${height}, width=1200, top=20, left=${width}, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no`);
|
|
35
35
|
};
|
|
36
36
|
export default {
|
|
37
|
-
install
|
|
38
|
-
app.provide(
|
|
37
|
+
install(app, {router, pinia, isAdmin}) {
|
|
38
|
+
app.provide('$hiprint', hiprint);
|
|
39
39
|
if (router) {
|
|
40
|
-
router.addRoute(
|
|
41
|
-
path:
|
|
42
|
-
name:
|
|
40
|
+
router.addRoute('Index', {
|
|
41
|
+
path: 'hiprint/designer',
|
|
42
|
+
name: '打印设计器',
|
|
43
43
|
meta: {
|
|
44
|
-
icon:
|
|
45
|
-
title:
|
|
44
|
+
icon: 'md-planet',
|
|
45
|
+
title: '打印设计器',
|
|
46
46
|
},
|
|
47
|
-
component: () => import(
|
|
47
|
+
component: () => import('yh-hiprint/HiprintDesigner.vue'),
|
|
48
48
|
});
|
|
49
49
|
router.addRoute({
|
|
50
|
-
path:
|
|
51
|
-
name:
|
|
50
|
+
path: '/preview',
|
|
51
|
+
name: 'printView',
|
|
52
52
|
meta: {
|
|
53
|
-
icon:
|
|
54
|
-
title:
|
|
53
|
+
icon: 'md-planet',
|
|
54
|
+
title: 'printView',
|
|
55
55
|
},
|
|
56
|
-
component: () => import(
|
|
56
|
+
component: () => import('yh-hiprint/hiprintPreview.vue'),
|
|
57
57
|
});
|
|
58
58
|
} else {
|
|
59
59
|
if (!router) {
|
|
60
|
-
cLog(
|
|
60
|
+
cLog('没有传递 router 对象,所以无法将路由添加到应用中', true);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yh-hiprint",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "Hiprint for Vue3 by NoahLiu in ForceCon in Hunan Changesha",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
"vue": "^3.0.0"
|
|
21
21
|
},
|
|
22
22
|
"author": "Liubin"
|
|
23
|
-
}
|
|
23
|
+
}
|