Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
肖文锋
/
pdfPreview
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
012b41f7
authored
Jun 04, 2020
by
xiaowenfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了下拉选择框以适应火狐
parent
d41daebd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
11 deletions
src/App.vue
src/App.vue
View file @
012b41f7
...
...
@@ -11,7 +11,7 @@
'pageUp',
pageIndex === 1 ? 'taoolbarCantUse' : ''
]"
title=
"
Previous Page
"
title=
"
上一页
"
id=
"previous"
tabindex=
"13"
data-l10n-id=
"previous"
...
...
@@ -26,7 +26,7 @@
'pageDown',
pageIndex === pageLength ? 'taoolbarCantUse' : ''
]"
title=
"
Next Page
"
title=
"
下一页
"
id=
"next"
tabindex=
"14"
data-l10n-id=
"next"
...
...
@@ -39,7 +39,7 @@
type=
"number"
id=
"pageNumber"
class=
"toolbarField pageNumber"
title=
"
Page
"
title=
"
页码
"
v-model=
"pageIndex"
size=
"4"
min=
"1"
...
...
@@ -51,7 +51,12 @@
<span
id=
"numPages"
class=
"toolbarLabel"
>
/
{{
pageLength
}}
</span>
<button
id=
"draggrad"
:class=
"['toolbarButton', draggradActive ? 'draggradActive' : '']"
title=
"抓手工具"
:class=
"[
'toolbarButton',
'draggrad',
draggradActive ? 'draggradActive' : ''
]"
tabindex=
"12"
data-l10n-id=
"findbar"
@
click=
"draggradHandle"
...
...
@@ -68,7 +73,7 @@
'zoomOut',
this.pageSize
<
=
0
.
5
?
'
taoolbarCantUse
'
:
''
]"
title=
"
Zoom Out
"
title=
"
缩小
"
tabindex=
"21"
data-l10n-id=
"zoom_out"
@
click=
"zoomOut(null)"
...
...
@@ -83,7 +88,7 @@
'zoomIn',
this.pageSize >= 4 ? 'taoolbarCantUse' : ''
]"
title=
"
Zoom In
"
title=
"
放大
"
tabindex=
"22"
data-l10n-id=
"zoom_in"
@
click=
"zoomIn(null)"
...
...
@@ -94,7 +99,7 @@
<span
id=
"scaleSelectContainer"
class=
"dropdownToolbarButton"
>
<select
id=
"scaleSelect"
title=
"
Zoom
"
title=
"
缩放选择
"
tabindex=
"23"
data-l10n-id=
"zoom"
v-model=
"selected"
...
...
@@ -105,7 +110,13 @@
:key=
"index"
:value=
"index"
:disabled=
"Object.keys(item)[0] === 'custom' ? true : false"
v-show=
"Object.keys(item)[0] === 'custom' ? false : true"
v-show=
"
Object.keys(item)[0] === 'custom'
? isFirefox
? true
: false
: true
"
>
{{
item
[
Object
.
keys
(
item
)[
0
]].
page_scale_percent
}}
</option
>
</select>
...
...
@@ -153,10 +164,12 @@ export default {
{
"4"
:
{
page_scale_percent
:
"400%"
,
value
:
4
}
},
{
custom
:
{
page_scale_percent
:
""
,
value
:
1
}
}
],
draggradActive
:
false
draggradActive
:
false
,
isFirefox
:
false
};
},
mounted
()
{
this
.
isFirefox
=
navigator
.
userAgent
.
indexOf
(
"Firefox"
)
>
1
;
pdfJs
.
GlobalWorkerOptions
.
workerSrc
=
require
(
"pdfjs-dist/build/pdf.worker"
);
this
.
preview
();
},
...
...
@@ -259,6 +272,7 @@ export default {
},
zoomIn
(
pageSize
)
{
let
result
=
Number
((
this
.
pageSize
+
0.05
).
toFixed
(
10
));
console
.
log
(
"result:"
,
result
);
let
currentSize
=
pageSize
?
pageSize
:
result
;
if
(
currentSize
>
4
)
{
return
;
...
...
@@ -282,8 +296,8 @@ export default {
this
.
selected
=
index
;
let
item
=
this
.
zoomList
[
index
];
let
key
=
Object
.
keys
(
item
)[
0
];
this
.
zoomList
[
index
][
key
].
page_scale_percent
=
parseInt
(
this
.
pageSize
*
100
)
+
"%"
;
let
result
=
Number
((
this
.
pageSize
*
100
).
toFixed
(
10
));
this
.
zoomList
[
index
][
key
].
page_scale_percent
=
result
+
"%"
;
},
previous
()
{
if
(
this
.
pageIndex
===
1
)
{
...
...
@@ -351,6 +365,9 @@ export default {
<
style
lang=
"scss"
>
@import
url("./css/viewer.css")
;
*
{
scrollbar-width
:
none
;
}
#app
{
width
:
100%
;
height
:
100%
;
...
...
@@ -363,6 +380,7 @@ export default {
#viewerContainerBox
{
margin
:
auto
;
position
:
relative
;
scrollbar-width
:
none
;
}
.taoolbarCantUse
{
opacity
:
0.5
;
...
...
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