从父级缩进子元素

时间:2018-04-09 14:47:23

标签: react-native

你怎么知道一个元素与父元素的偏移量?或者我怎么知道滚动ScrollView有多少?

var obj = {
    prop1  : 0,
    prop2  : 1,
    func1 : function (){
         var x = {
             func_Inner : function(){
                 //ATTEMPTING TO CALL FUNC2 ON obj WON'T WORK
                 this.func2()

                 //NEITHER THIS
                 //this.func2().bind(obj);
             }
         }
         // Here's is bound to the current context.
         x.func_Inner.bind(this)(); 
    },
    func2 : function (){
         //console.log(this)
         console.log(this.prop1,this.prop2)
    }
}

obj.func1();

此选项不合适,因为它识别屏幕边缘的偏移,但不识别父元素的开头

attach

0 个答案:

没有答案