Commit d7f1a8e3 by 李伟康

提交

1 parent d2b85f40
......@@ -293,7 +293,10 @@
@focus="handleTextBoxFocus(item)"
:boxHeight="item.boxHeight"
:style="{ width: item.width || defaultWidth }"
></textBox>
:class="{'text-box-disabled':item.isDisabled}"
:disabled="item.isDisabled"
>
</textBox>
<!-- 地图 -->
<div
v-else-if="item.type === 'map'"
......@@ -534,7 +537,7 @@ export default {
this.formObj[targetItem.name] = val
},
handleTextBoxFocus (targetItem) {
this.$refs[targetItem.name + 'TextBox'][0].setEdit(this.formObj[targetItem.name])
if (this.formObj[targetItem.name]) this.$refs[targetItem.name + 'TextBox'][0].setEdit(this.formObj[targetItem.name])
},
// 禁用富文本
forbidEdit (targetItem) {
......
......@@ -8,7 +8,7 @@
import E from 'wangeditor'
export default {
name: 'textBox',
data() {
data () {
return {
editor: '',
content: '',
......@@ -23,15 +23,22 @@ export default {
boxHeight: {
type: Number,
default: 240
}
},
disabled: Boolean
},
mounted() {
mounted () {
this.getEdit()
},
watch: {
'disabled' (n) {
if (n) this.forbidEdit()
}
},
methods: {
getEdit() {
getEdit () {
const _this = this
this.editor = new E('#div-demo')
this.editor.config.focus = false
this.editor.config.uploadImgShowBase64 = true
this.editor.config.showMenuTooltips = true
this.editor.config.menuTooltipPosition = 'down'
......@@ -47,7 +54,7 @@ export default {
this.$emit('focus')
}
// 上传图片
this.editor.config.customUploadImg = function(resultFiles, insertImgFn) {
this.editor.config.customUploadImg = function (resultFiles, insertImgFn) {
var file = resultFiles[0]
var reader = new FileReader()
// 默认1MB
......@@ -73,7 +80,7 @@ export default {
}
}
// 上传视频
this.editor.config.customUploadVideo = function(resultFiles, insertVideoFn) {
this.editor.config.customUploadVideo = function (resultFiles, insertVideoFn) {
var file = resultFiles[0]
var reader = new FileReader()
// 默认1MB
......@@ -101,12 +108,12 @@ export default {
this.editor.config.onchangeTimeout = 5000
this.editor.create()
},
setEdit(html) {
setEdit (html) {
this.$nextTick(() => {
this.editor.txt.html(html)
})
},
forbidEdit() {
forbidEdit () {
// this.editor.$textElem.attr('contenteditable', false)
this.editor.disable()
}
......
......@@ -198,7 +198,7 @@ export default {
console.log(data)
this.formData.map(e => {
e.isDisabled = disabled
if (disabled && e.name == 'description') this.$refs.formRef.forbidEdit(e)
// if (disabled && e.name == 'description') this.$refs.formRef.forbidEdit(e)
if (e.name == 'merchantId') e.optionList = [{
confId: data.merchantId,
confName: data.merchantName
......@@ -369,6 +369,17 @@ export default {
border-color: #f56c6c !important;
}
}
/deep/.text-box-disabled{
.w-e-toolbar,
.w-e-text-container{
background-color: #eee !important;
border-color: #e4e7ed !important;
&:hover{
cursor: not-allowed;
}
}
color: #c0c4cc;
}
}
}
.title {
......
......@@ -191,6 +191,9 @@ export default {
/deep/.el-tabs__item.is-active {
font-weight: 700;
}
/deep/.el-tabs__item.is-disabled{
cursor: not-allowed;
}
/deep/.el-pager {
line-height: 28px;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!