1.5.1 • Published 3 years ago

@growingio/node v1.5.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

GrowingIO Node

GrowingIO 基础node节点,提供node信息获取功能

安装

npm install --save @gio/node

使用方式

new GioNode(element [, actionType [, directInteract]])

参数

参数类型必选默认值说明
elementElement元素节点
actionType'click' | 'change' | 'submit' | 'heatmap'×当前响应事件类型
directInteractboolean×false是否直接交互(触发事件)节点

actionType取值heatmap时,不会自动向上查找有效父元素,直接获取当前元素信息

属性

parentElement

​ 获取父节点

ignore

​ 节点是否标记了忽略,存在data-growing-ignore=true

origin

​ 原始节点

target

​ 计算后的目标节点

fullXpath

​ 完整的xpath,不进行截取的

xpath

​ 截取后的xpath

skeleton

​ 完整的xpath骨架

info

​ 节点的信息,形如

{
  index: '1',
  href: 'https://growingio.com',
  content: '元素内容',
  xpath: '/div.item/div#ctx/span/a',
  fullXpath: '/div.body/div.item/div#ctx/span/a',
  skeleton: '/div/div/div/span/a'
}

方法

traceable

node.traceable

​ 判断当前节点应不应该被追踪,返回true|false

trackInfos

node.rackInfos()

​ 冒泡获取所有可追踪的节点信息

actions

node.actions()

​ 获取当前节点可支持的事件列表,值包括clck,chng,sbmt

circledElement

node.circledElement()

​ 根据当前元素返回可圈选的元素