Akryum / Akryum/vue-virtual-scroller

size change not detected despite sizeDependencies

Aberta
#227 6 comentários 0 reações 0 responsáveis Ver no GitHub
question
Linguagem predominante
TypeScript
Estrelas
10.8k
Forks
973
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

My rows have textarea, which can be dragged to resize
I'm using mutationObserver to detect the size change and update data on the component
and I'm passing this data field as the sizeDependencies (ie. `:sizeDependencies="['textAreaHeight']"`),

but despite the data getting modified, the size isn't recalculated.

I tried to use also the `IdState` (see below) and `:sizeDependencies="['idState.textAreaHeight']"` but had same affect.

Can you help me detect my error?

```javascript
export default {
name: 'MockRow',
extends: DynamicScrollerItem,
idState() { //replaces data - see https://github.com/Akryum/vue-virtual-scroller#idstate
return {
textAreaHeight: -1
}
},
mixins: [
IdState({
idProp: vm => vm.item.name,
}),
],
mounted(){
let textarea = this.$refs.textarea;
let $this=this;
function outputsize() {
console.log( textarea.offsetHeight)
$this.idState.textAreaHeight = textarea.offsetHeight;
}
outputsize();
this.areaChangeObserver = new MutationObserver(outputsize).observe(textarea, {
attributes: true, attributeFilter: [ "style" ]
})
},
beforeDestroy() {
if (this.areaChangeObserver) {
this.areaChangeObserver.disconnect();
}
},
```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.