angular - 设置水平滚动位置 - Ionic 3
问题描述
我正在尝试更改ion-scroll
元素的滚动位置,但没有得到..这是我尝试过的:
ts
import { Component, ViewChild, ElementRef } from "@angular/core";
@ViewChild("scroller", { read: ElementRef })
private scroller: ElementRef;
html
<ion-scroll #scroller scrollX="true" style="height: 21px; white-space: nowrap">
<div>... </div>
</ion-scroll>
这有效
this.scroller.nativeElement.style.background = "blue";
这不起作用
this.scroller.nativeElement.scrollLeft = this.scroller.nativeElement.scrollWidth;
解决方案
推荐阅读
- python - 如何在循环内打印一次变量值
- python - 为什么我不能在这段代码中使用 pop() 函数删除列表中的元素?
- algorithm - 在图中查找所有唯一路径并返回最便宜的路径
- string - 如何在汇编语言中只打印字符串中的整数/数字
- react-admin - 根据需要调用 LoadingIndicator
- c - C程序中的类型转换失败
- java - 将 JSON 格式的 API 响应与 CSV 进行比较,两者都有数百万条记录,并且 csv 列名称与 JSON 字段不同
- android - android benchmark没有显示在日志文件中运行
- php - 在 Windows 服务器上安装 PHP v 8
- python - tkinter 单选按钮未在类中显示值