detail.vue 545 B

1234567891011121314151617181920212223242526272829303132
  1. <template>
  2. <div>
  3. <editor :content="content" @on-change="onChange" />
  4. </div>
  5. </template>
  6. <script>
  7. import editor from './index'
  8. export default {
  9. components: {
  10. editor,
  11. },
  12. props: ['data', 'value', 'option', 'error'],
  13. data () {
  14. return {
  15. content: this.value[this.data.keyword],
  16. }
  17. },
  18. methods: {
  19. onChange (content) {
  20. this.$hub.$emit(this.data.hub, {
  21. type: 'value',
  22. payload: Object.assign(this.value, {
  23. [this.data.keyword]: content,
  24. }),
  25. })
  26. },
  27. },
  28. }
  29. </script>