Former-commit-id: 85b7eab49c2dc78468172c3746fe9144b6eb3544 Former-commit-id: e6e5da925e91f568a3950b9e988b4d4996cf5bf5 Former-commit-id: 75fc437dff21eb7120b2518771d6bde731a5c75d
46 lines
1.0 KiB
Vue
46 lines
1.0 KiB
Vue
<template>
|
|
<d2-container>
|
|
<d2-demo-page-header slot="header" title="导出文本"/>
|
|
<el-input
|
|
type="textarea"
|
|
:autosize="{minRows: 2, maxRows: 4}"
|
|
placeholder="请输入内容 然后点击保存按钮导出文本文档"
|
|
v-model="text">
|
|
</el-input>
|
|
<div class="d2-mt d2-mb">
|
|
<el-button type="primary" @click="exportTxt">
|
|
<d2-icon name="download"/>
|
|
保存为 txt
|
|
</el-button>
|
|
</div>
|
|
<d2-markdown url="/static/md/插件 - 导出.md"/>
|
|
</d2-container>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data () {
|
|
return {
|
|
text: ''
|
|
}
|
|
},
|
|
methods: {
|
|
exportTxt () {
|
|
// 校验是不是空
|
|
if (this.text === '') {
|
|
this.$message('虽然可以为空 但是出于体验不建议这样 还是写点东西吧')
|
|
return
|
|
}
|
|
// 导出
|
|
this.$export.txt({
|
|
text: this.text,
|
|
title: '文本'
|
|
})
|
|
.then(() => {
|
|
this.$message('导出文本成功')
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|