Answer the question
In order to leave comments, you need to log in
Why does @click fire once?
in the component's template the following code:
<td :style="{background: colorCell[k]}" :class="getClass(k)" v-for="(typeFlat,k) in build" :key="k" @contextmenu.prevent="addString($event, building[j].id, k)" @click="changeCell(build[k], k, build.id)">
<span v-if="isLink(typeFlat)">
<a href="javascript:void(0)">
{{ typeFlat.substr(0, lengthString) }}
</a>
</span>
<span v-else>
{{ typeof typeFlat === 'string' ? typeFlat.substr(0, lengthString) : typeFlat}}
</span>
<div style="display: none" :ref="build.id+k">
<textarea :value="message" @change="message = $event.target.value" @blur="finishСhange(j)"/>
<select @blur="finishСhange()" @click="setMessage($event)" v-model="message">
</select>
</div>
</td>
changeCell(val, title, id){
console.log(this.eventFlag)
if (this.eventFlag){
this.eventFlag = false
} else {
this.eventFlag = true
}
}
Answer the question
In order to leave comments, you need to log in
Go from the opposite, remove all unnecessary, all attributes, menus, etc., and check. Might be in conflict with something.
The changeCell method made the div with ref=build.id+k visible, and the element nested in it in focus, by clicking on another td, the focus disappeared and made the div with ref=build.id+k - disaplay: none, after that the @ event click on cells didn't work. When I moved the hide div from ref=build.id+k to the changeCell method, everything worked.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question