相关疑难解决方法(0)

HTML中style.width和offsetwidth的区别?

我注意到这个offsetwidth数字略大一些.同样的style.heightoffsetheight.

html javascript

23
推荐指数
2
解决办法
2万
查看次数

如何在指令和组件中获取元素的宽度/高度?

@Component({
    selector: '.donation',
    template: `
    <figure id="donation" move>
        <img src="image/qrcode.png"/>
        <figcaption>
        Buy me a cup of coffee.
        </figcaption>
    </figure>
    `
})
export class DonationComponent{}

@Directive({
    selector: '[move]'
})
export class MoveDirective{}
Run Code Online (Sandbox Code Playgroud)

嘿,我想在MoveDirective和DonationComponent中获取元素的宽度/高度,我多次阅读文档但仍无法找到解决这个问题的方法.有人知道这个请帮帮我,非常感谢!

angular-directive angular-components angular

18
推荐指数
2
解决办法
8万
查看次数