Skip to content

Commit ea512fe

Browse files
author
ex_likx5
committed
修改字符串传入的bug
1 parent c5e9626 commit ea512fe

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

print/packages/print.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: lee
33
* @Date: 2021-05-10 11:45:50
44
* @LastEditors: lee
5-
* @LastEditTime: 2021-05-14 10:46:44
5+
* @LastEditTime: 2021-05-20 15:39:43
66
* @Description: file content
77
*/
88
import Print from './printarea.js';
@@ -30,15 +30,16 @@ export default {
3030
if (typeof binding.value === 'string') {
3131
// 全局打印
3232
id = binding.value;
33-
window.print();
34-
return
3533
} else if (typeof binding.value === 'object' && !!binding.value.id) {
3634
// 局部打印
3735
id = binding.value.id;
3836
let ids = id.replace(new RegExp("#", "g"), '');
3937
let elsdom = document.getElementById(ids);
4038
if (!elsdom) console.log("id in Error"), id = '';
4139

40+
} else {
41+
window.print();
42+
return
4243
}
4344
localPrint();
4445
});

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
</div>
66
<div v-if="config">
7-
<button v-print="printObj">Print the entire page</button>
7+
<button v-print="'#printMe'">Print the entire page</button>
88
<div class="box"
99
v-show="printLoading">
1010
<div class="loader-04"></div>

0 commit comments

Comments
 (0)