Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
finance-manage
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
finance-oa
finance-manage
Commits
903b5aeb
Commit
903b5aeb
authored
Dec 18, 2021
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增图片预览组件
parent
7492dcc9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
0 deletions
+70
-0
ruoyi-ui/src/components/ImagePreview/index.vue
ruoyi-ui/src/components/ImagePreview/index.vue
+67
-0
ruoyi-ui/src/main.js
ruoyi-ui/src/main.js
+3
-0
No files found.
ruoyi-ui/src/components/ImagePreview/index.vue
0 → 100644
View file @
903b5aeb
<
template
>
<el-image
:src=
"`$
{realSrc}`" fit="cover" :style="`width:${realWidth};height:${realHeight};`" :preview-src-list="[`${realSrc}`]">
<div
slot=
"error"
class=
"image-slot"
>
<i
class=
"el-icon-picture-outline"
></i>
</div>
</el-image>
</
template
>
<
script
>
import
{
isExternal
}
from
'
@/utils/validate
'
export
default
{
name
:
'
ImagePreview
'
,
props
:
{
src
:
{
type
:
String
,
required
:
true
},
width
:
{
type
:
[
Number
,
String
],
default
:
''
},
height
:
{
type
:
[
Number
,
String
],
default
:
''
}
},
computed
:
{
realSrc
()
{
if
(
isExternal
(
this
.
src
))
{
return
this
.
src
}
return
process
.
env
.
VUE_APP_BASE_API
+
this
.
src
},
realWidth
()
{
return
typeof
this
.
width
==
'
string
'
?
this
.
width
:
`
${
this
.
width
}
px`
},
realHeight
()
{
return
typeof
this
.
height
==
'
string
'
?
this
.
height
:
`
${
this
.
height
}
px`
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.el-image
{
border-radius
:
5px
;
background-color
:
#ebeef5
;
box-shadow
:
0
0
5px
1px
#ccc
;
::v-deep
.el-image__inner
{
transition
:
all
0
.3s
;
cursor
:
pointer
;
&
:hover
{
transform
:
scale
(
1
.2
);
}
}
::v-deep
.image-slot
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
width
:
100%
;
height
:
100%
;
color
:
#909399
;
font-size
:
30px
;
}
}
</
style
>
ruoyi-ui/src/main.js
View file @
903b5aeb
...
@@ -29,6 +29,8 @@ import Editor from "@/components/Editor"
...
@@ -29,6 +29,8 @@ import Editor from "@/components/Editor"
import
FileUpload
from
"
@/components/FileUpload
"
import
FileUpload
from
"
@/components/FileUpload
"
// 图片上传组件
// 图片上传组件
import
ImageUpload
from
"
@/components/ImageUpload
"
import
ImageUpload
from
"
@/components/ImageUpload
"
// 图片预览组件
import
ImagePreview
from
"
@/components/ImagePreview
"
// 字典标签组件
// 字典标签组件
import
DictTag
from
'
@/components/DictTag
'
import
DictTag
from
'
@/components/DictTag
'
// 头部标签组件
// 头部标签组件
...
@@ -54,6 +56,7 @@ Vue.component('RightToolbar', RightToolbar)
...
@@ -54,6 +56,7 @@ Vue.component('RightToolbar', RightToolbar)
Vue
.
component
(
'
Editor
'
,
Editor
)
Vue
.
component
(
'
Editor
'
,
Editor
)
Vue
.
component
(
'
FileUpload
'
,
FileUpload
)
Vue
.
component
(
'
FileUpload
'
,
FileUpload
)
Vue
.
component
(
'
ImageUpload
'
,
ImageUpload
)
Vue
.
component
(
'
ImageUpload
'
,
ImageUpload
)
Vue
.
component
(
'
ImagePreview
'
,
ImagePreview
)
Vue
.
use
(
directive
)
Vue
.
use
(
directive
)
Vue
.
use
(
plugins
)
Vue
.
use
(
plugins
)
...
...
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