nativescript - 在 HtmlView 中处理链接打开事件
问题描述
我有一个 html 代码,里面有一个链接。下面的代码是我的模板:
<HtmlView [html]="htmlString" ></HtmlView>
这是我的组件:
import { Component } from "@angular/core";
@Component({
moduleId: module.id,
templateUrl: "./creating-htmlview.component.html"
})
export class CreatingHtmlViewExampleComponent {
public htmlString: string;
constructor() {
this.htmlString = '<a href="http://google.com/">google</a>';
}
}
运行时如何处理a
HtmlView 内部的元素?有没有办法检测用户何时运行链接?
解决方案
这还不支持,有一个开放的功能请求。你可以编写一个插件来实现像 ClickableSpan 或 Linkify 这样的原生 api。
推荐阅读
- java - 使用批处理文件将文件夹从服务器复制到本地驱动器
- sql - Oracle - 如何获取范围分区参数所需的列的值
- reactjs - React 路由 - 如何在父组件中使用 OnClick 组织重定向
- reactjs - React Native 与 JSON 模式形式
- javascript - 如何使用设备运动使画布动画随手机移动
- docker - 尽管 java/gradle 版本相同,但 Gradle 守护程序未重用
- apache-kafka-streams - 重置 Kafka 流应用程序
- python - 特征重要性 - 隔离回归森林
- git - 如何“恢复”由于合并冲突而中止的合并后挂钩?
- java - 如何将pdf文件转换为docx文件