Skip to content

Commit 7a5fc1f

Browse files
committed
## 0.15.3: fixed #19
1 parent 176059f commit 7a5fc1f

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

ui/src/views/note/index.vue

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
<div class="note-item shadow rounded w-full " v-for="(item,index) in list" :key="item.noteId">
2727
<div class="max-note-height relative" :style="{
2828
'--note-max-height': item.openFlag?'auto':'240px',
29-
paddingBottom:item.needOpenFlag?'20px':0
29+
paddingBottom:noteHeightMap[item.noteId]>240?'20px':0
3030
}">
31-
<render :id="item.noteId" @onHtmlChanged="onHtmlChange(item,index)" :tags="item.tags" :content="item.content.markdown" style="display: block"/>
32-
<div v-if="item.needOpenFlag" @click="item.openFlag = !item.openFlag" class="cursor-pointer text-white" style="position: absolute;background: rgb(139 139 139 / 66%);bottom:0;width:100%;text-align: center;height: 20px;line-height: 20px">
31+
<render :id="item.noteId" @onHtmlChanged="onHtmlChange(item)" :tags="item.tags" :content="item.content.markdown" style="display: block"/>
32+
<div v-if="noteHeightMap[item.noteId]>240" @click="item.openFlag = !item.openFlag" class="cursor-pointer text-white" style="position: absolute;background: rgb(139 139 139 / 66%);bottom:0;width:100%;text-align: center;height: 20px;line-height: 20px">
3333
展开 / 收起
3434
</div>
3535
</div>
@@ -124,7 +124,6 @@ function loadList(searchKey = '') {
124124
item.content = JSON.parse(item.content)
125125
item.tags = JSON.parse(item.tags || '[]')
126126
item.openFlag = false
127-
item.needOpenFlag = false
128127
return item
129128
})
130129
})
@@ -210,18 +209,15 @@ onMounted(()=>{
210209
})
211210
212211
213-
const onHtmlChange = (item, index)=>{
212+
const onHtmlChange = (item)=>{
214213
const noteId = item.noteId
215214
const h = document.getElementById(noteId).clientHeight
216-
if (h > 240){
217-
item.needOpenFlag = true
218-
list.value[index] = item
219-
}
215+
noteHeightMap.value[noteId] = h
216+
}
220217
221-
item.height = h
222218
223-
console.log(item)
224-
}
219+
const noteHeightMap = ref({})
220+
225221
</script>
226222

227223

0 commit comments

Comments
 (0)