Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
print
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangchenyue
print
Commits
c8069443
Commit
c8069443
authored
Sep 29, 2021
by
wcmoon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 关闭发送请求
parent
cd45c020
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
8 deletions
+14
-8
images.ts
images.ts
+0
-0
package-lock.json
package-lock.json
+0
-0
App.vue
src/App.vue
+9
-5
print.ts
src/hooks/print.ts
+5
-3
No files found.
images.ts
0 → 100644
View file @
c8069443
This source diff could not be displayed because it is too large. You can
view the blob
instead.
package-lock.json
View file @
c8069443
This diff is collapsed.
Click to expand it.
src/App.vue
View file @
c8069443
<
template
>
<
template
>
<img
alt=
"Vue logo"
src=
"./assets/logo.png"
>
<img
alt=
"Vue logo"
src=
"./assets/logo.png"
>
{{
progress
}}
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
Vue
}
from
'vue-class-component'
;
import
{
Vue
}
from
'vue-class-component'
;
import
{
watch
,
reactive
}
from
'vue'
;
import
{
watch
,
reactive
}
from
'vue'
;
import
print
from
"@/hooks/print"
;
import
print
from
"@/hooks/print"
;
import
{
imageBase64
}
from
"../images"
;
export
default
{
export
default
{
setup
()
{
setup
()
{
let
images
=
reactive
<
string
[]
>
([
'1'
]);
let
images
=
reactive
<
string
[]
>
([
imageBase64
]);
let
{
progress
}
=
print
(
images
);
let
{
progress
}
=
print
(
images
);
images
.
push
(
'2'
);
setTimeout
(()
=>
{
images
.
push
(
'2'
);
images
.
push
(
imageBase64
);
},
3000
)
console
.
log
(
progress
);
console
.
log
(
progress
);
return
{
return
{
images
images
,
progress
}
}
}
}
}
}
...
...
src/hooks/print.ts
View file @
c8069443
...
@@ -53,11 +53,12 @@ export default function(images:any) {
...
@@ -53,11 +53,12 @@ export default function(images:any) {
*/
*/
function
goon
()
{
function
goon
()
{
// 没有消息了就关闭 ws
// 没有消息了就关闭 ws
if
(
sendList
.
length
==
=
sendedAmount
.
value
)
{
if
(
sendList
.
length
<
=
sendedAmount
.
value
)
{
disconnectWebSocket
(
)
;
disconnectWebSocket
(;
}
else
{
}
else
{
// 从 sendListPrintData 中取出要打印的数据
// 从 sendListPrintData 中取出要打印的数据
const
printData
=
(
sendListPrintData
[
sendedAmount
.
value
]
as
any
).
getPrintData
();
console
.
log
(
sendListPrintData
[
sendedAmount
.
value
])
const
printData
=
sendListPrintData
[
sendedAmount
.
value
];
let
sendDataString
=
"{"
+
let
sendDataString
=
"{"
+
"
\"
model
\"
:
\"
"
+
'L42 PRO'
+
"
\"
,"
+
"
\"
model
\"
:
\"
"
+
'L42 PRO'
+
"
\"
,"
+
"
\"
printerID
\"
:
\"
ZPL
\"
,"
+
"
\"
printerID
\"
:
\"
ZPL
\"
,"
+
...
@@ -67,6 +68,7 @@ export default function(images:any) {
...
@@ -67,6 +68,7 @@ export default function(images:any) {
"
\"
Items
\"
:["
+
printData
+
"]}]"
+
"
\"
Items
\"
:["
+
printData
+
"]}]"
+
"}"
;
"}"
;
const
data
=
decodeURIComponent
(
sendDataString
);
const
data
=
decodeURIComponent
(
sendDataString
);
console
.
log
(
data
);
ws
.
send
(
data
)
ws
.
send
(
data
)
sendedAmount
.
value
+=
1
;
sendedAmount
.
value
+=
1
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment