Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Polymer 如何设置<;铁卷轴阈值>;将目标滚动到";文件「;用于聚合物起动器套件_Polymer_Polymer Starter Kit - Fatal编程技术网

Polymer 如何设置<;铁卷轴阈值>;将目标滚动到";文件「;用于聚合物起动器套件

Polymer 如何设置<;铁卷轴阈值>;将目标滚动到";文件「;用于聚合物起动器套件,polymer,polymer-starter-kit,Polymer,Polymer Starter Kit,我打算通过将scroll target设置为“document”,在PSK v3中实现一个无限滚动器,但它对PSK不起作用。下面是代码片段: 项目:[[item.n]] 我已经用纯HTML测试了scroll target=“document”,效果很好。我想知道当用户滚动到特定页面/视图的末尾时,PSK应该如何设置触发事件。有时,您的滚动位置在开始时比queryMoreData函数触发事件的位置低得多。在此函数中,您需要通过将clearTriggers方法调用到queryMoreData函数

我打算通过将
scroll target
设置为
“document”
,在PSK v3中实现一个无限滚动器,但它对PSK不起作用。下面是代码片段:


项目:[[item.n]]

我已经用纯HTML测试了
scroll target=“document”
,效果很好。我想知道当用户滚动到特定页面/视图的末尾时,PSK应该如何设置触发事件。

有时,您的滚动位置在开始时比
queryMoreData
函数触发事件的位置低得多。在此函数中,您需要通过将
clearTriggers
方法调用到
queryMoreData
函数中来清除阈值:

queryMoreData() {
    //check if you have more data to load than

    ironScrollTheshold.clearTriggers();
}

之后,它将再次开始侦听滚动位置是否再次达到阈值(假设可滚动区域中的内容已增长)

显然,您需要将
滚动目标设置为
滚动目标,并在
ready()
中使用以下代码:-

ready(){
{//为设置滚动目标
让myApp=document.querySelector('my-app');
让appHeader=myApp.shadowRoot.querySelector('app-header');
此.$.threshold.scrollTarget=appHeader.scrollTarget;
}
}

您必须将
铁卷轴阈值
元素的卷轴目标属性设置为“文档

还要注意的是,
熨斗列表的滚动目标属性设置为
熨斗滚动阈值
元素-“阈值”的id

<iron-scroll-threshold scroll-target="document" id="threshold" on-lower-threshold="loadMoreData" lower-threshold="100">
<iron-list id="list" items="[[items]]" as="item" scroll-target="threshold" grid>
<!-- template -->
</iron-list>
</iron-scroll-threshold>

在上一个示例中,我实际上调用了
this.$.threshold.clearTriggers()
来清除
queryMoreData()函数中的触发器。问题似乎出在错误的滚动目标上,因为PSK的结构中还有其他可滚动的元素,比如应用抽屉布局/应用标题布局(我不太确定)