mirror of
https://github.com/dataease/dataease.git
synced 2026-05-23 22:08:34 +08:00
Merge pull request #4046 from dataease/pr@dev_memory_component
Pr@dev memory component
This commit is contained in:
@@ -14,7 +14,6 @@ export default {
|
||||
toast('已经到顶了')
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
downComponent({ componentData, curComponent }) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-input
|
||||
v-count="{value, maxlength}"
|
||||
v-count="{value, maxlength, buttonDisabled}"
|
||||
:placeholder="$t('fu.search_bar.please_input')"
|
||||
show-word-limit
|
||||
:disabled="disabled"
|
||||
@@ -16,14 +16,16 @@ export default {
|
||||
directives: {
|
||||
count: {
|
||||
update: function(el, binding) {
|
||||
const lg = binding.value.value?.length || 0
|
||||
const { value, maxlength, buttonDisabled } = binding.value
|
||||
if (buttonDisabled) return
|
||||
const lg = value?.length || 0
|
||||
const count = el.querySelector('.el-input__count')
|
||||
if (!count) return
|
||||
if (!lg) {
|
||||
if (count?.classList?.contains('no-zore')) {
|
||||
count.classList.remove('no-zore')
|
||||
}
|
||||
count.innerHTML = `0/${binding.value.maxlength || 200}`
|
||||
count.innerHTML = `0/${maxlength || 200}`
|
||||
return
|
||||
}
|
||||
if (el.querySelector('.no-zore')) {
|
||||
@@ -34,7 +36,7 @@ export default {
|
||||
const num = document.createElement('span')
|
||||
const total = document.createElement('span')
|
||||
num.style.color = '#1F2329'
|
||||
total.innerHTML = `/${binding.value.maxlength || 200}`
|
||||
total.innerHTML = `/${maxlength || 200}`
|
||||
num.innerHTML = lg
|
||||
if (!newCount) return
|
||||
newCount.classList.add('el-input__count', 'no-zore')
|
||||
@@ -44,6 +46,11 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
inject: {
|
||||
elForm: {
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
props: {
|
||||
disabled: Boolean,
|
||||
value: String,
|
||||
@@ -52,6 +59,13 @@ export default {
|
||||
default: 200
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
buttonDisabled() {
|
||||
return Object.prototype.hasOwnProperty.call(this.$options.propsData, 'disabled')
|
||||
? this.disabled
|
||||
: (this.elForm || {}).disabled
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleChange(val) {
|
||||
this.$emit('input', val)
|
||||
|
||||
Reference in New Issue
Block a user