-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
宋慧武
committed
Jul 17, 2019
1 parent
0a30711
commit 63ca878
Showing
3 changed files
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* Created Date: 2019-07-13 | ||
* Author: 宋慧武 | ||
* ------ | ||
* Last Modified: Monday 2019-07-15 16:57:44 pm | ||
* Last Modified: Wednesday 2019-07-17 11:35:35 am | ||
* Modified By: the developer formerly known as 宋慧武 at <[email protected]> | ||
* ------ | ||
* HISTORY: | ||
|
@@ -24,7 +24,7 @@ class App { | |
@observable content = null; | ||
|
||
@action.bound | ||
@track("click.after", 22121) | ||
@track("trigger.after", 22121) | ||
handleClick(val, e) { | ||
console.log("handleClick 方法正常执行。并受到参数:", val, e.target); | ||
this.date = Date.now(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* Created Date: 2019-07-14 | ||
* Author: 宋慧武 | ||
* ------ | ||
* Last Modified: Tuesday 2019-07-16 11:07:38 am | ||
* Last Modified: Wednesday 2019-07-17 11:34:06 am | ||
* Modified By: the developer formerly known as 宋慧武 at <[email protected]> | ||
* ------ | ||
* HISTORY: | ||
|
@@ -37,7 +37,7 @@ class Home extends Component { | |
}; | ||
} | ||
|
||
@track("click.after", 22121) | ||
@track("trigger.after", 22121) | ||
handleClick(val, e) { | ||
console.log("handleClick 方法正常执行。并受到参数:", val, e.target); | ||
this.setState({ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* Created Date: 2019-07-08 | ||
* Author: 宋慧武 | ||
* ------ | ||
* Last Modified: Tuesday 2019-07-16 11:10:24 am | ||
* Last Modified: Wednesday 2019-07-17 11:33:12 am | ||
* Modified By: the developer formerly known as 宋慧武 at <[email protected]> | ||
* ------ | ||
* HISTORY: | ||
|
@@ -22,8 +22,8 @@ const ONCE = "once"; | |
const modifiers = { | ||
UVPV: "UVPV", // 特殊的修饰符 | ||
TONP: "TONP", // 特殊的修饰符,表示页面停留时长 | ||
CLICK: "click", | ||
CLICK_AFTER: "click.after", | ||
TRIGGER: "trigger", | ||
TRIGGER_AFTER: "trigger.after", | ||
ASYNC: "async", | ||
ASYNC_DELAY: "async.delay" | ||
}; | ||
|
@@ -107,14 +107,14 @@ export function track(modifier, eventId, params = {}) { | |
}; | ||
} | ||
// 事件行为埋点 | ||
else if (modifier.includes(modifiers.CLICK)) { | ||
else if (modifier.includes(modifiers.TRIGGER)) { | ||
handler = function(...args) { | ||
let context = this; | ||
const isRC = this.isReactComponent; // 是否为 react 组件 | ||
const evts = this.trackEvents || this.props.trackEvents; | ||
const once = modifier.includes(ONCE); | ||
const onceProp = `${name}_${eventId}`; | ||
const after = modifier.includes(modifiers.CLICK_AFTER); | ||
const after = modifier.includes(modifiers.TRIGGER_AFTER); | ||
const tck = () => { | ||
if (this[onceProp]) return; // 如果存在once修饰符,且为true则直接返回 | ||
vaildEvent(evts, eventId); // 检测eventId是否合法 | ||
|