Skip to content

Commit

Permalink
## 0.15.3: fixed #19
Browse files Browse the repository at this point in the history
  • Loading branch information
glennliao committed Dec 10, 2023
1 parent 176059f commit 7a5fc1f
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions ui/src/views/note/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
<div class="note-item shadow rounded w-full " v-for="(item,index) in list" :key="item.noteId">
<div class="max-note-height relative" :style="{
'--note-max-height': item.openFlag?'auto':'240px',
paddingBottom:item.needOpenFlag?'20px':0
paddingBottom:noteHeightMap[item.noteId]>240?'20px':0
}">
<render :id="item.noteId" @onHtmlChanged="onHtmlChange(item,index)" :tags="item.tags" :content="item.content.markdown" style="display: block"/>
<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">
<render :id="item.noteId" @onHtmlChanged="onHtmlChange(item)" :tags="item.tags" :content="item.content.markdown" style="display: block"/>
<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">
展开 / 收起
</div>
</div>
Expand Down Expand Up @@ -124,7 +124,6 @@ function loadList(searchKey = '') {
item.content = JSON.parse(item.content)
item.tags = JSON.parse(item.tags || '[]')
item.openFlag = false
item.needOpenFlag = false
return item
})
})
Expand Down Expand Up @@ -210,18 +209,15 @@ onMounted(()=>{
})


const onHtmlChange = (item, index)=>{
const onHtmlChange = (item)=>{
const noteId = item.noteId
const h = document.getElementById(noteId).clientHeight
if (h > 240){
item.needOpenFlag = true
list.value[index] = item
}
noteHeightMap.value[noteId] = h
}

item.height = h

console.log(item)
}
const noteHeightMap = ref({})

</script>


Expand Down

0 comments on commit 7a5fc1f

Please sign in to comment.