Skip to content
This repository was archived by the owner on Jun 23, 2023. It is now read-only.

Commit 377337d

Browse files
authored
Merge pull request #5 from chengpeiquan/develop
Develop
2 parents c2c814e + f96c833 commit 377337d

4 files changed

Lines changed: 32 additions & 6 deletions

File tree

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
vue-baidu-analytics 使用说明
22
===
33

4-
基于Vue开发的百度统计插件,可以在 `Vue-CLI脚手架项目` 或者 `引入了Vue相关CDN的普通页面` 上使用,使用本插件的项目需要引入 `Vue Router`
4+
基于Vue开发的百度统计插件,可以在 `Vue-CLI脚手架项目` 或者 `引入了Vue相关CDN的普通页面`,以及 `VuePress` 项目上使用,使用本插件的项目需要引入 `Vue Router`
55

66
> @v2.0版本更新:<br>最新版支持 Vue 3.x,同时兼容 Vue 2.x 使用,具体使用方法请看下方说明及demo。<br>对Vue 3.0感兴趣,但还在观望的同学,欢迎阅读我踩坑总结的:[Vue 3.0 学习教程](https://vue3.chengpeiquan.com/) (持续更新ing)
77
@@ -104,6 +104,30 @@ createApp(app)
104104
.mount('#app');
105105
```
106106

107+
### 在 VuePress 里使用
108+
109+
插件也支持在Vue的静态文档 [VuePress](https://vuepress.vuejs.org/zh/) 项目里使用。
110+
111+
在项目下的 `/docs/.vuepress` 文件夹下,创建一个 `enhanceApp.js`,按照下面的方式引入即可启动数据上报功能。
112+
113+
官方文档传送门:[应用级别的配置 - VuePress](https://vuepress.vuejs.org/zh/guide/basic-config.html#%E5%BA%94%E7%94%A8%E7%BA%A7%E5%88%AB%E7%9A%84%E9%85%8D%E7%BD%AE)
114+
115+
```js
116+
import baiduAnalytics from 'vue-baidu-analytics'
117+
118+
export default ({ Vue, router }) => {
119+
Vue.use(baiduAnalytics, {
120+
router: router,
121+
siteIdList: [
122+
'aaaaaaaaaaaaaaaaaaa',
123+
'bbbbbbbbbbbbbbbbbbb',
124+
'ccccccccccccccccccc'
125+
],
126+
isDebug: false
127+
});
128+
};
129+
```
130+
107131
可在开发环境打开debug模式了解相关的上报情况(上线前记得关闭debug)。
108132

109133
## 方法

dist/vue-baidu-analytics.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-baidu-analytics.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-baidu-analytics",
3-
"version": "2.0.0",
4-
"description": "A data collection tool that supports reporting of single-page application data built by Vue 3.0 & 2.0, based on baidu statistics.",
3+
"version": "2.0.1",
4+
"description": "A data collection tool that supports reporting of single-page application data built by Vue 3.0 & 2.0 & VuePress, based on baidu statistics.",
55
"main": "dist/vue-baidu-analytics.min.js",
66
"types": "vue-baidu-analytics.d.ts",
77
"scripts": {
@@ -16,11 +16,13 @@
1616
"vue baidu",
1717
"vue 百度统计",
1818
"vue analytics",
19+
"vuepress analytics",
1920
"vue 3.0 baidu",
2021
"vue 3.0 百度统计",
2122
"vue 3.0 analytics",
22-
"spa 3.0 analytics",
23+
"spa analytics",
2324
"baidu统计",
25+
"vuepress统计",
2426
"百度统计"
2527
],
2628
"author": "chengpeiquan",

0 commit comments

Comments
 (0)