Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
mongo-ui
Commits
97b6c50a
Commit
97b6c50a
authored
Aug 27, 2020
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 弹框组件移除pdfjs
parent
2838c5d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
33 deletions
+3
-33
PopupWithIframe.vue
src/components/PopupWithIframe.vue
+3
-33
No files found.
src/components/PopupWithIframe.vue
View file @
97b6c50a
...
...
@@ -18,7 +18,7 @@
v-html=
"content"
></div>
<!-- iframe -->
<div
class=
"protocol-frame-wrap"
v-if=
"
!isPdf &&
url && scrollRefresh"
>
<div
class=
"protocol-frame-wrap"
v-if=
"url && scrollRefresh"
>
<iframe
class=
"protocol-frame"
:src=
"url"
frameborder=
"0"
height=
"100%"
></iframe>
</div>
<!-- slot -->
...
...
@@ -26,9 +26,7 @@
<slot></slot>
</div>
<!-- content -->
<div
class=
"protocol-content"
v-if=
"isPdf && scrollRefresh && !$slots.default"
>
<pdf
v-for=
"(item, index) in pdfNumPages"
:key=
"index"
:src=
"pdfUrl"
:page=
"index + 1"
/>
</div>
<div
class=
"protocol-content"
v-if=
"scrollRefresh && !$slots.default"
></div>
</cr-popup>
</
template
>
...
...
@@ -38,7 +36,6 @@
* @param {type}
* @return:
*/
import
pdf
from
"
vue-pdf
"
;
const
CHANGE_EVENT
=
"
input
"
;
export
default
{
name
:
"
PopupWithIframe
"
,
...
...
@@ -57,9 +54,6 @@ export default {
default
:
""
}
},
components
:
{
pdf
},
watch
:
{
value
(
val
)
{
this
.
popupShow
=
val
;
...
...
@@ -70,41 +64,17 @@ export default {
popupShow
(
val
)
{
this
.
$emit
(
CHANGE_EVENT
,
val
);
if
(
!
val
)
{
this
.
pdfNumPages
=
null
;
this
.
pdfUrl
=
null
;
setTimeout
(()
=>
{
this
.
scrollRefresh
=
false
;
},
300
);
}
}
},
computed
:
{
isPdf
()
{
const
isPdf
=
this
.
url
.
indexOf
(
"
pdf
"
)
>
-
1
;
isPdf
&&
this
.
pdfTask
();
return
isPdf
;
}
},
data
()
{
return
{
popupShow
:
false
,
scrollRefresh
:
true
,
pdfUrl
:
""
,
pdfNumPages
:
null
scrollRefresh
:
true
};
},
methods
:
{
pdfTask
()
{
this
.
pdfUrl
=
pdf
.
createLoadingTask
(
this
.
url
);
this
.
pdfUrl
.
promise
.
then
(
pdf
=>
{
this
.
pdfNumPages
=
pdf
.
numPages
;
console
.
error
(
pdf
);
})
.
catch
(
err
=>
{
console
.
error
(
err
);
});
}
}
};
</
script
>
...
...
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