Former-commit-id: 3673eec59eb46c38b9ae8ce91b1266aad2c5dad8 Former-commit-id: cefa3b9cadc9e6d08c871de341a9bff190095753 Former-commit-id: d5ca056fbc7d365144c17649d896d9aee035ce5d Former-commit-id: 6195c693929b52506195d8f5280b8f03ad4f6d47 [formerly 00bd4b8ea0fc897a02d2c10214a584b2e9d2938e] Former-commit-id: cabbed8c3d836fe5c26891119f6fdeb00aaae7c8 Former-commit-id: b972a4829b2c5ab9bbbf48dff6d997645f04e6c8 Former-commit-id: 1c1152f8a70de53296f7625e06036a9bf4ce842b Former-commit-id: f2b4b61ee5465c5edd3789cc52004d80188b5853 Former-commit-id: 78a67c9892149c27fc69e5dd079c2d1afeb33d1b
48 lines
1.0 KiB
Vue
48 lines
1.0 KiB
Vue
<template>
|
|
<d2-container type="card">
|
|
<template slot="header">导出文本</template>
|
|
<el-input
|
|
type="textarea"
|
|
:autosize="{minRows: 2, maxRows: 4}"
|
|
placeholder="请输入内容 然后点击保存按钮导出文本文档"
|
|
v-model="text">
|
|
</el-input>
|
|
<div class="d2-mt">
|
|
<el-button type="primary" @click="exportTxt">
|
|
<d2-icon name="download"/>
|
|
保存为 txt
|
|
</el-button>
|
|
</div>
|
|
</d2-container>
|
|
</template>
|
|
|
|
<script>
|
|
import Vue from 'vue'
|
|
import pluginExport from '@d2-projects/vue-table-export'
|
|
Vue.use(pluginExport)
|
|
export default {
|
|
data () {
|
|
return {
|
|
text: ''
|
|
}
|
|
},
|
|
methods: {
|
|
exportTxt () {
|
|
// 校验是不是空
|
|
if (this.text === '') {
|
|
this.$message('虽然可以为空 但是出于体验不建议这样 还是写点东西吧')
|
|
return
|
|
}
|
|
// 导出
|
|
this.$export.txt({
|
|
text: this.text,
|
|
title: '文本'
|
|
})
|
|
.then(() => {
|
|
this.$message('导出文本成功')
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|