mirror of
https://github.com/any86/any-rule.git
synced 2025-07-14 15:38:58 +08:00
feat: 增加百度统计的事件监控
This commit is contained in:
parent
8f4719e928
commit
b901984305
202
src/App.vue
202
src/App.vue
@ -1,95 +1,116 @@
|
|||||||
<template>
|
<template>
|
||||||
<main>
|
<main>
|
||||||
<article class="fixed">
|
<article class="fixed">
|
||||||
<a href="https://github.com/any86/any-rule" target="_blank" class="github">
|
<a
|
||||||
<svg height="20" viewBox="0 0 16 16" version="1.1" width="20" aria-hidden="true">
|
onclick="_hmt.push(['_trackEvent', '交互', '点击github', '悬浮'])"
|
||||||
<path
|
href="https://github.com/any86/any-rule"
|
||||||
fill-rule="evenodd"
|
target="_blank"
|
||||||
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"
|
class="github"
|
||||||
></path>
|
>
|
||||||
</svg>
|
<svg height="20" viewBox="0 0 16 16" version="1.1" width="20" aria-hidden="true">
|
||||||
<span>github</span>
|
<path
|
||||||
</a>
|
fill-rule="evenodd"
|
||||||
<a class="message" href="https://github.com/any86/any-rule/issues/new" target="_blank">留言</a>
|
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"
|
||||||
</article>
|
></path>
|
||||||
<header>
|
</svg>
|
||||||
<h1>正则大全</h1>
|
<span>github</span>
|
||||||
<a style="margin-left:15px;color:#000;" href="https://github.com/any86/any-rule" target="_blank" class="github">
|
</a>
|
||||||
<svg height="20" viewBox="0 0 16 16" version="1.1" width="20" aria-hidden="true">
|
<a
|
||||||
<path
|
onclick="_hmt.push(['_trackEvent', '交互', '留言'])"
|
||||||
fill-rule="evenodd"
|
class="message"
|
||||||
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"
|
href="https://github.com/any86/any-rule/issues/new"
|
||||||
></path>
|
target="_blank"
|
||||||
</svg>
|
>留言</a>
|
||||||
github</a>
|
</article>
|
||||||
<input
|
<header>
|
||||||
ref="searchInput"
|
<h1>正则大全</h1>
|
||||||
v-model="keyword"
|
<a
|
||||||
autofocus
|
onclick="_hmt.push(['_trackEvent', '交互', '点击github', '头部'])"
|
||||||
@keyup="search"
|
style="margin-left:15px;color:#000;"
|
||||||
@mouseenter="selectSearchInputText"
|
href="https://github.com/any86/any-rule"
|
||||||
@focus="selectSearchInputText"
|
target="_blank"
|
||||||
class="search-input"
|
class="github"
|
||||||
placeholder="搜索关键词, 如'手机'"
|
>
|
||||||
type="text"
|
<svg height="20" viewBox="0 0 16 16" version="1.1" width="20" aria-hidden="true">
|
||||||
>
|
<path
|
||||||
</header>
|
fill-rule="evenodd"
|
||||||
|
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"
|
||||||
|
></path>
|
||||||
|
</svg>
|
||||||
|
github
|
||||||
|
</a>
|
||||||
|
<input
|
||||||
|
ref="searchInput"
|
||||||
|
v-model="keyword"
|
||||||
|
autofocus
|
||||||
|
@keyup="search"
|
||||||
|
@mouseenter="selectSearchInputText"
|
||||||
|
@focus="selectSearchInputText"
|
||||||
|
class="search-input"
|
||||||
|
placeholder="搜索关键词, 如'手机'"
|
||||||
|
type="text"
|
||||||
|
>
|
||||||
|
</header>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<ul v-if="0 < rules.length" class="list">
|
<ul v-if="0 < rules.length" class="list">
|
||||||
<li
|
<li
|
||||||
@mouseenter="mouseenterHandler(index)"
|
@mouseenter="mouseenterHandler(index)"
|
||||||
v-for="({title, rule, events}, index) in rules"
|
v-for="({title, rule, events}, index) in rules"
|
||||||
:key="title"
|
:key="title"
|
||||||
class="row"
|
class="row"
|
||||||
>
|
>
|
||||||
<i class="border"></i>
|
<i class="border"></i>
|
||||||
<h2>{{title}}</h2>
|
<h2>{{title}}</h2>
|
||||||
<p class="rule">
|
<p class="rule">
|
||||||
<span :data-clipboard-text="rule" class="btn-copy">点击复制</span>
|
<span :data-clipboard-text="rule" class="btn-copy">点击复制</span>
|
||||||
<a :href="`https://github.com/any86/any-rule/issues/new?title=我有更好的正则: ${title}`" target="_blank" class="btn-better">我有不同意见</a>
|
<a
|
||||||
{{rule}}
|
:href="`https://github.com/any86/any-rule/issues/new?title=我有更好的正则: ${title}`"
|
||||||
</p>
|
target="_blank"
|
||||||
<section class="verification">
|
class="btn-better"
|
||||||
<label>
|
>我有不同意见</a>
|
||||||
<input
|
{{rule}}
|
||||||
ref="input"
|
</p>
|
||||||
v-model="list[index].value"
|
<section class="verification">
|
||||||
@blur="check(index, 'blur')"
|
<label>
|
||||||
@keyup="check(index, 'keyup')"
|
<input
|
||||||
>
|
ref="input"
|
||||||
<span class="btn-clear" @click="reset(index)">清空</span>
|
v-model="list[index].value"
|
||||||
</label>
|
@blur="check(index, 'blur')"
|
||||||
|
@keyup="check(index, 'keyup')"
|
||||||
|
>
|
||||||
|
<span class="btn-clear" @click="reset(index)">清空</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
<div class="tip">
|
<div class="tip">
|
||||||
<template v-if="undefined !== list[index].isOk">
|
<template v-if="undefined !== list[index].isOk">
|
||||||
<p v-if="list[index].isOk" class="success">通过</p>
|
<p v-if="list[index].isOk" class="success">通过</p>
|
||||||
<p v-else class="error">不通过</p>
|
<p v-else class="error">不通过</p>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="trigger">
|
<section class="trigger">
|
||||||
<h3>验证时机</h3>
|
<h3>验证时机</h3>
|
||||||
<label>
|
<label>
|
||||||
<input v-model="list[index].events.blur" type="checkbox"> blur
|
<input v-model="list[index].events.blur" type="checkbox"> blur
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input v-model="list[index].events.keyup" type="checkbox"> keyup
|
<input v-model="list[index].events.keyup" type="checkbox"> keyup
|
||||||
</label>
|
</label>
|
||||||
</section>
|
</section>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p v-else align="center">无数据</p>
|
<p v-else align="center">无数据</p>
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import RULES from '@/RULES';
|
import RULES from '@/RULES';
|
||||||
import ClipboardJS from 'clipboard';
|
import ClipboardJS from 'clipboard';
|
||||||
import throttle from 'lodash/throttle';
|
// import throttle from 'lodash/throttle';
|
||||||
export default {
|
export default {
|
||||||
name: 'app',
|
name: 'app',
|
||||||
|
|
||||||
@ -140,6 +161,8 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.rules = RULES;
|
this.rules = RULES;
|
||||||
}
|
}
|
||||||
|
/* eslint-disable */
|
||||||
|
_hmt.push(['_trackEvent', '交互', '搜索', '关键词', this.keyword]);
|
||||||
},
|
},
|
||||||
|
|
||||||
selectSearchInputText() {
|
selectSearchInputText() {
|
||||||
@ -149,10 +172,8 @@ export default {
|
|||||||
autoFocus(index) {
|
autoFocus(index) {
|
||||||
this.$refs.input[index].focus();
|
this.$refs.input[index].focus();
|
||||||
},
|
},
|
||||||
|
/* eslint-disable */
|
||||||
mouseenterHandler(index){
|
mouseenterHandler(index) {},
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
// mouseenterHandler: throttle((index)=>{
|
// mouseenterHandler: throttle((index)=>{
|
||||||
// this.$refs.input[index].focus();
|
// this.$refs.input[index].focus();
|
||||||
@ -173,6 +194,11 @@ export default {
|
|||||||
const row = this.list[index];
|
const row = this.list[index];
|
||||||
row.isOk = rule.test(row.value);
|
row.isOk = rule.test(row.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('blur' === type) {
|
||||||
|
/* eslint-disable */
|
||||||
|
_hmt.push(['_trackEvent', '交互', 'input框', this.list[index].value]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -332,9 +358,9 @@ main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
>.btn-better{
|
> .btn-better {
|
||||||
@extend .btn-copy;
|
@extend .btn-copy;
|
||||||
background-color:#ff5722;
|
background-color: #ff5722;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user