nuxt-spreadsheet
v0.0.3
Published
A nuxt module for x-data-spreadsheet
Downloads
10
Readme
nuxt-spreadsheet
A nuxt module for x-data-spreadsheet
Nuxt module for https://github.com/myliang/x-spreadsheet
Setup
- Add
nuxt-spreadsheet
dependency to your project
npm install nuxt-spreadsheet
- Add
nuxt-spreadsheet
to themodules
section ofnuxt.config.js
{
modules: [
'nuxt-spreadsheet',
]
}
Usage
Add the spreadsheet to your page
<template>
<div>
<spreadsheet :options="options" :data="data" :onChange="onChange" ref="spreadsheet"/>
</div>
</template>
<script>
export default {
data() {
return {
spreadsheet: null,
// If other options needed
options: {
...
},
// Initial data for spreadsheet
data: {
...
}
}
},
mounted() {
this.spreadsheet = this.$refs.spreadsheet.spreadsheet
},
methods: {
onChange: function(data) {
}
}
}
</script>
The x-data-spreadsheet spreadsheet object can be found via refs: this.$refs.spreadsheet.spreadsheet
See https://github.com/myliang/x-spreadsheet/blob/master/docs/index.html for data format
Options
// default options
{
showToolbar: true,
showGrid: true,
showContextmenu: true,
view: {
height: () => document.documentElement.clientHeight,
width: () => document.documentElement.clientWidth,
},
row: {
len: 100,
height: 25,
},
col: {
len: 26,
width: 100,
indexWidth: 60,
minWidth: 60,
},
style: {
bgcolor: '#ffffff',
align: 'left',
valign: 'middle',
textwrap: false,
strike: false,
underline: false,
color: '#0a0a0a',
font: {
name: 'Helvetica',
size: 10,
bold: false,
italic: false,
},
},
}
Development
- Clone this repository
- Install dependencies using
yarn install
ornpm install
- Start development server using
npm run dev
License
Copyright (c) Rasmus Schlünsen