Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
monster_isme
Excel_export
提交
9fc1d318
E
Excel_export
项目概览
monster_isme
/
Excel_export
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
Excel_export
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9fc1d318
编写于
5月 20, 2020
作者:
monster_isme
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add setwaterMark()
上级
26a5c8c7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
4 deletion
+38
-4
src/views/Excel_Export.vue
src/views/Excel_Export.vue
+38
-4
未找到文件。
src/views/Excel_Export.vue
浏览文件 @
9fc1d318
<
template
>
<el-button
type=
"primary"
@
click=
"ExportToExcel"
>
Excel-Export
</el-button>
<div
class=
"watermark"
>
<el-button
class=
"excel_button"
type=
"primary"
@
click=
"ExportToExcel"
>
Excel-Export
</el-button>
<div
:style=
"`color:$
{color};transform: rotate(${rotate}deg);width:${wm_w}%;height:${wm_h}%;opacity: ${opacity}`"
class="wm" v-for="(i,index) in watermarkNum"
:key="index"
>
{{
watermarkText
}}
</div>
</div>
</
template
>
<
script
>
...
...
@@ -13,11 +19,23 @@
{
id
:
'
2
'
,
name
:
'
api
'
,
username
:
'
api接口
'
,
sex
:
'
男
'
,
email
:
'
api@wyy.com
'
},
{
id
:
'
3
'
,
name
:
'
vue-cli3
'
,
username
:
'
vue.js
'
,
sex
:
'
男
'
,
email
:
'
vue@wyy.com
'
},
{
id
:
'
4
'
,
name
:
'
elementUI
'
,
username
:
'
elementUI模板
'
,
sex
:
'
男
'
,
email
:
'
elementUI@wyy.com
'
}
]
],
watermarkNum
:
0
,
//水印数量
watermarkRow
:
2
,
//列数
watermarkLine
:
2
,
//行数
rotate
:
-
30
,
//文字旋转角度
color
:
'
#ccc
'
,
//文字颜色
watermarkText
:
'
仅供测试使用
'
,
//水印文本
wm_w
:
0
,
//水印宽度百分比
wm_h
:
0
,
//水印高度百分比
opacity
:
0.2
//水印透明度
}
},
created
(){},
mounted
(){},
mounted
(){
//在挂载后载入水印
this
.
setwaterMark
();
},
methods
:
{
//Excel导出
ExportToExcel
(){
...
...
@@ -28,13 +46,29 @@
const
data
=
this
.
formatJson
(
filterVal
,
list
);
export_json_to_excel
(
tHeader
,
data
,
'
测试Excel导出
'
);
},
//Excel导出函数
formatJson
(
filterVal
,
jsonData
){
return
jsonData
.
map
(
v
=>
filterVal
.
map
(
j
=>
v
[
j
]))
},
//创建水印
setwaterMark
(){
let
that
=
this
;
that
.
watermarkNum
=
that
.
watermarkRow
*
that
.
watermarkLine
;
that
.
wm_w
=
100
/
that
.
watermarkRow
;
that
.
wm_h
=
100
/
that
.
watermarkLine
;
}
}
}
</
script
>
<
style
lang=
"less"
scoped
>
.watermark{
width: 100%;
height: auto;
display: flex;
.excel_button{
margin-top: 120px;
}
}
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录