docs(grid/export): [grid] update export docs (#900)

This commit is contained in:
ajaxzheng 2023-11-22 05:04:48 -08:00 committed by GitHub
parent f6a01396a4
commit 41b2b7d9ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View File

@ -19,7 +19,7 @@
</div>
</template>
<script setup lang="jsx">
<script setup>
import { ref } from 'vue'
import {
Grid as TinyGrid,
@ -80,9 +80,14 @@ function clearDataEvent() {
function toCsvEvent() {
theGridRef.value.exportCsv({
//
filename: 'table.csv',
original: true,
//
isHeader: false,
//
useTabs: false,
//
data: tableData.value
})
}

View File

@ -19,7 +19,7 @@
</div>
</template>
<script lang="jsx">
<script>
import { Grid, GridColumn, GridToolbar, Button } from '@opentiny/vue'
export default {
@ -83,9 +83,14 @@ export default {
},
toCsvEvent() {
this.$refs.theGrid.exportCsv({
//
filename: 'table.csv',
original: true,
//
isHeader: false,
//
useTabs: false,
//
data: this.tableData
})
}

View File

@ -129,15 +129,6 @@ const downloadCsc = (options, content) => {
if (navigator.msSaveBlob && window.Blob) {
navigator.msSaveBlob(new Blob([content], { type: 'text/csv;charset=utf-8' }), options.filename)
} else if (browser.name === 'ie') {
const win = window.top.open('about:blank', '_blank')
win.opener = null
win.document.charset = 'utf-8'
win.document.write(content)
win.document.close()
win.document.execCommand('SaveAs', options.filename)
win.close()
} else {
const linkElem = document.createElement('a')
@ -159,7 +150,6 @@ const downloadCsc = (options, content) => {
export default {
_exportCsv(options) {
let { visibleColumn, scrollXLoad, scrollYLoad, treeConfig } = this
let mergedOpts = {
columns: null,
columnFilterMethod: (column) => column.property && !['index', 'selection', 'radio'].includes(column.type),