Akryum / Akryum/vue-virtual-scroller

size change not detected despite sizeDependencies

オープン
#227 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
question
主要言語
TypeScript
スター
10.8k
フォーク
973
PR マージ指標
30日以内にマージされた PR はありません

説明

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();
}
},
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。