李林
2024-03-13 eb2f43c595f6e0602c74ba8516b6324ffcab3e59
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<style scoped>
    #luckysheet {
        margin: 0px;
        padding: 0px;
        position: absolute;
        width: 100%;
        height: 100%;
        left: 0px;
        top: 0px;
    }
</style>
<style>
    #luckysheet .save{
        width: 50px;
        height: 26px;
        color: #fff;
        background-color: #3A7BFA;
        border-radius: 4px;
        border-color: transparent;
        cursor: pointer;
    }
    
    #luckysheet .save:hover{
        opacity: .8;
    }
    
    #luckysheet .save:active{
        opacity: .7;
    }
</style>
<template>
    <div id="luckysheet"></div>
</template>
 
<script>
// import { data } from 'jquery';
    export default {
        props: ['data','title'],
        data() {
            return {
            }
        },
        mounted() {
            this.$nextTick(() => {
                this.templateWrite()
            })
        },
        methods: {
            templateWrite() {
                if(this.data!=null&&this.data!=''){
                    let option = JSON.parse(this.data)
                    option.title = this.title
                    luckysheet.create(option)
                }else{
                    $(function() {
                        //配置项
                        var options = {
                            container: 'luckysheet',
                            title: this.title,
                            lang: "zh",
                            showsheetbar: false,
                            showstatisticBarConfig: {
                                view: false
                            },
                            data: [{
                                name: '模板',
                                order: '0'
                            }],
                            enableAddRow: false,
                            row: 100,
                            column: 26,
                            enableAddBackTop: false,
                            showtoolbarConfig: {
                                chart: false, // '图表'
                                pivotTable: false,  //'数据透视表'
                                protection:false, // '工作表保护'
                            },
                            cellRightClickConfig: {
                                copyAs: false, // 复制为
                                hideRow: false, // 隐藏选中行和显示选中行
                                hideColumn: false, // 隐藏选中列和显示选中列
                                sort: false, // 排序选区
                                filter: false, // 筛选选区
                                chart: false, // 图表生成
                                image: false, // 插入图片
                                matrix: false, // 矩阵操作选区
                            },
                            myFolderUrl: 'http://127.0.0.1/',
                            functionButton: '<button onClick="excelClosed()" class="save">保存</button>'
                        }
                        luckysheet.create(options)
                    })
                }
            }
        }
    }
</script>