Skip to content

Commit

Permalink
组件加入tinymce
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Feb 8, 2019
1 parent 07f80e0 commit 5f6df47
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/components/FormDesigner/Container.vue
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ import 'vue-awesome/icons/sliders-h'
import 'vue-awesome/icons/regular/image'
import 'vue-awesome/icons/chalkboard'
import 'vue-awesome/icons/upload'
import 'vue-awesome/icons/text-height'
import GenerateForm from './GenerateForm'
// eslint-disable-next-line no-unused-vars
Expand Down
13 changes: 1 addition & 12 deletions src/components/FormDesigner/GenerateForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,9 @@
v-for="(col, colIndex) in item.columns"
:key="colIndex"
:span="col.span">


<template v-for="citem in col.list" >
<el-form-item
v-if="citem.type=='blank'"
:label="citem.name"
:prop="citem.model"
:key="citem.key">
<slot
:name="citem.model"
:model="models"/>
</el-form-item>

<genetate-form-item
v-else
:key="citem.key"
:models.sync="models"
:remote="remote"
Expand Down
7 changes: 7 additions & 0 deletions src/components/FormDesigner/GenerateFormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,21 @@
/>
</template>

<template v-if="widget.type=='richtext'">
<Tinymce :height="400" v-model="dataModel"></Tinymce>

</template>


</el-form-item>
</template>

<script>
import Tinymce from '@/components/Tinymce' // 富文本编辑器
export default {
components: {
Tinymce,
},
props: ['widget', 'models', 'rules', 'remote'],
data() {
Expand Down
6 changes: 6 additions & 0 deletions src/components/FormDesigner/WidgetFormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
:label-width="element.name===''?'0px':''"

>
<template v-if="element.type == 'richtext'">
<Tinymce :height="400" v-model="element.options.defaultValue"
/>
</template>

<template v-if="element.type == 'input'">
<el-input
Expand Down Expand Up @@ -209,11 +213,13 @@ import 'vue-awesome/icons/sliders-h'
import 'vue-awesome/icons/regular/image'
import 'vue-awesome/icons/chalkboard'
import UploadAffix from '@/components/UploadAffix' // 上传模块
import Tinymce from '@/components/Tinymce' // 富文本编辑器
export default {
components: {
icon,
UploadAffix,
Tinymce,
},
props: ['element', 'select', 'index', 'data'],
data() {
Expand Down
10 changes: 10 additions & 0 deletions src/components/FormDesigner/componentsConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,16 @@ export const advanceComponents = [
},
},
},

{
type: 'richtext',
name: '富文本',
icon: 'text-height',
options: {
defaultValue: '',

},
},
]

export const layoutComponents = [
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tinymce/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div :class="{fullscreen:fullscreen}" class="tinymce-container editor-container">
<textarea :id="tinymceId" class="tinymce-textarea"/>
<div class="editor-custom-btn-container">
<div class="editor-custom-btn-container" style="display:none">
<editorImage color="#1890ff" class="editor-upload-btn" @successCBK="imageSuccessCBK"/>
</div>
</div>
Expand Down
11 changes: 1 addition & 10 deletions src/views/Archive/person_edit.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
<template>
<div>
<Tinymce ref="editor" :height="400" v-model="content" />
<crud-table tableName="person" toolbarButton="add,clear,search" handleButton="edit,delete"></crud-table>
</div>
</template>
<script>
import Tinymce from '@/components/Tinymce'
export default {
name: 'PersonEdit',
data() {
return {
content: '',
}
},
components: {
Tinymce,
},
}
</script>

0 comments on commit 5f6df47

Please sign in to comment.