fix: 仪表板文字组件编辑文字可能保存不上问题

This commit is contained in:
wangjiahao 2021-12-24 17:29:08 +08:00
parent 77db760939
commit db09c658e3
2 changed files with 12 additions and 3 deletions

View File

@ -229,7 +229,6 @@ export default {
},
methods: {
_isMobile() {
console.log('navigator.userAgent:' + navigator.userAgent)
const flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
this.terminal = flag ? 'mobile' : 'pc'
// this.terminal = 'mobile'
@ -311,7 +310,7 @@ export default {
}
},
handleMouseDown() {
this.$store.commit('setClickComponentStatus', fals)
this.$store.commit('setClickComponentStatus', false)
},
initMobileCanvas() {
this.$store.commit('openMobileLayout')

View File

@ -15,7 +15,16 @@
@input="handleInput"
v-html="element.propValue"
/>
<div v-if="!canEdit" :style="{ verticalAlign: element.style.verticalAlign }" @dblclick="setEdit" v-html="element.propValue" />
<div
v-if="!canEdit"
:style="{ verticalAlign: element.style.verticalAlign }"
@dblclick="setEdit"
@paste="clearStyle"
@mousedown="handleMousedown"
@blur="handleBlur"
@input="handleInput"
v-html="element.propValue"
/>
</div>
<div v-else class="v-text">
<div :style="{ verticalAlign: element.style.verticalAlign }" v-html="textInfo" />
@ -75,6 +84,7 @@ export default {
},
methods: {
handleInput(e) {
this.$store.state.styleChangeTimes++
this.$emit('input', this.element, e.target.innerHTML)
this.$store.commit('recordStyleChange')
},