Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</div>
</template>

<script setup lang="jsx">
<script setup>
import { ref } from 'vue'
import {
Grid as TinyGrid,
Expand Down Expand Up @@ -80,9 +80,14 @@ function clearDataEvent() {

function toCsvEvent() {
theGridRef.value.exportCsv({
// 文件名称
filename: 'table.csv',
original: true,
// 是否导出表头
isHeader: false,
// 是否在每行后面添加制表符
useTabs: false,
// 导出的数据
data: tableData.value
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</div>
</template>

<script lang="jsx">
<script>
import { Grid, GridColumn, GridToolbar, Button } from '@opentiny/vue'

export default {
Expand Down Expand Up @@ -83,9 +83,14 @@ export default {
},
toCsvEvent() {
this.$refs.theGrid.exportCsv({
// 文件名称
filename: 'table.csv',
original: true,
// 是否导出表头
isHeader: false,
// 是否在每行后面添加制表符
useTabs: false,
// 导出的数据
data: this.tableData
})
}
Expand Down
10 changes: 0 additions & 10 deletions packages/renderless/src/grid/plugins/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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),
Expand Down
Loading