SheetExcel.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <div id="sheet-container">
  3. </div>
  4. </template>
  5. <script>
  6. import { initSheet } from '../common/option';
  7. export default {
  8. props: {
  9. option: {
  10. type: Object,
  11. default: ''
  12. },
  13. sheetInfo: {
  14. type: Object,
  15. default: ()=>{}
  16. },
  17. limit: {
  18. type: Object,
  19. default: ()=>{
  20. return {disabled:false}
  21. }
  22. },
  23. },
  24. data() {
  25. return {
  26. sheetObj: {}
  27. }
  28. },
  29. methods: {
  30. init() {
  31. let optionData = this.option ? this.option : {};
  32. let callbackItems={updated:this.updateEmit}
  33. initSheet('sheet-container',optionData,this.sheetInfo,this.limit,callbackItems)
  34. },
  35. copyDisable(e){
  36. // 变向的禁止复制
  37. // console.log(e.target.value && e.target.value.indexOf('lucksheet'));
  38. if(!this.limit.disabled) return
  39. if(e.target.value && e.target.value.indexOf('lucksheet')){
  40. luckysheet.enterEditMode();
  41. // luckysheet.exitEditMode();
  42. return false
  43. }
  44. },
  45. updateEmit(){
  46. this.$emit("updated")
  47. }
  48. },
  49. destroyed() {
  50. luckysheet.destroy();
  51. },
  52. mounted() {
  53. this.init();
  54. document.addEventListener('copy',this.copyDisable)
  55. },
  56. beforeDestroy(){
  57. document.removeEventListener('copy',this.copyDisable)
  58. }
  59. }
  60. </script>
  61. <style scoped lang="scss">
  62. #sheet-container {
  63. margin:0;padding:0;
  64. position:absolute;
  65. width:100%;left: 0px;top: 0;bottom:0px;
  66. }
  67. </style>
  68. <style lang="scss">
  69. .luckysheet .toolbar {
  70. background: none;
  71. margin: 0;
  72. padding: 0;
  73. }
  74. .luckysheet-input-box {
  75. z-index: 99999;
  76. }
  77. </style>