WordProofread.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <span class="word-proofread-wrapper">
  3. <el-button class="btn" :style="buttonStyle" @click.native="showWordFlag = true">{{ buttonText }}</el-button>
  4. <el-dialog
  5. v-if="showWordFlag"
  6. :visible.sync="showWordFlag"
  7. :show-close="true"
  8. :close-on-click-modal="true"
  9. :modal-append-to-body="true"
  10. :append-to-body="true"
  11. :lock-scroll="true"
  12. width="80%"
  13. class="practiceBox"
  14. >
  15. <CheckWord :data="safeWordData" @saveWord="handleSaveWord" />
  16. </el-dialog>
  17. </span>
  18. </template>
  19. <script>
  20. import CheckWord from '@/views/book/courseware/create/components/base/common/CheckWord.vue';
  21. export default {
  22. name: 'WordProofread',
  23. components: {
  24. CheckWord,
  25. },
  26. props: {
  27. wordData: {
  28. type: Object,
  29. default: () => ({ detail: [] }),
  30. },
  31. buttonText: {
  32. type: String,
  33. default: '分词校对',
  34. },
  35. buttonStyle: {
  36. type: String,
  37. default: '',
  38. },
  39. },
  40. data() {
  41. return {
  42. showWordFlag: false,
  43. };
  44. },
  45. computed: {
  46. safeWordData() {
  47. if (!this.wordData || !Array.isArray(this.wordData.detail)) {
  48. return { detail: [] };
  49. }
  50. return this.wordData;
  51. },
  52. },
  53. methods: {
  54. handleSaveWord(saveArr) {
  55. this.$emit('save', saveArr);
  56. this.showWordFlag = false;
  57. },
  58. },
  59. };
  60. </script>