mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-15 04:42:23 +08:00
refactor(placeable): using property to change element style
This commit is contained in:
parent
21dcbb4649
commit
583a36ea2a
@ -52,7 +52,7 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.$refs.content.style = 'position: absolute;'
|
||||
this.$refs.content.style.position = 'absolute'
|
||||
this.$nextTick().then(() => {
|
||||
this.registerScrollListeners()
|
||||
this.registerResizeListener()
|
||||
@ -79,7 +79,10 @@ export default {
|
||||
// debugger
|
||||
// console.log('scroll', activatorBoundingClientRect, contentBoundingClientRect)
|
||||
const [placementTransform, suggsetedTransformOrigin] = calcPlacementTransfrom(this.placement, activatorBoundingClientRect, contentBoundingClientRect)
|
||||
this.$refs.content.style = 'position: absolute;' + placementTransform + `transform-origin: ${suggsetedTransformOrigin};`
|
||||
this.$refs.content.style.position = 'absolute'
|
||||
this.$refs.content.style.top = placementTransform.top
|
||||
this.$refs.content.style.left = placementTransform.left
|
||||
this.$refs.content.style.transformOrigin = suggsetedTransformOrigin
|
||||
this.$refs.content.setAttribute('n-suggested-transform-origin', suggsetedTransformOrigin)
|
||||
if (this.widthMode === 'activator' && this.$refs.contentInner) {
|
||||
this.$refs.contentInner.style.minWidth = activatorBoundingClientRect.width + 'px'
|
||||
|
Loading…
Reference in New Issue
Block a user