refactor(placeable): using property to change element style

This commit is contained in:
07akioni 2019-07-26 16:35:11 +08:00
parent 21dcbb4649
commit 583a36ea2a

View File

@ -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'