From 351af146c070d3838f5601eec6a17013179c0a2a Mon Sep 17 00:00:00 2001 From: chengpeiquan Date: Fri, 8 Jan 2021 23:42:51 +0800 Subject: [PATCH] Release v2.0.1 --- README.md | 26 +++++++++++++++++++++++++- package.json | 8 +++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e569134..c8216e9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ vue-baidu-analytics 使用说明 === -基于Vue开发的百度统计插件,可以在 `Vue-CLI脚手架项目` 或者 `引入了Vue相关CDN的普通页面` 上使用,使用本插件的项目需要引入 `Vue Router`。 +基于Vue开发的百度统计插件,可以在 `Vue-CLI脚手架项目` 或者 `引入了Vue相关CDN的普通页面`,以及 `VuePress` 项目上使用,使用本插件的项目需要引入 `Vue Router`。 > @v2.0版本更新:
最新版支持 Vue 3.x,同时兼容 Vue 2.x 使用,具体使用方法请看下方说明及demo。
对Vue 3.0感兴趣,但还在观望的同学,欢迎阅读我踩坑总结的:[Vue 3.0 学习教程](https://vue3.chengpeiquan.com/) (持续更新ing) @@ -104,6 +104,30 @@ createApp(app) .mount('#app'); ``` +### 在 VuePress 里使用 + +插件也支持在Vue的静态文档 [VuePress](https://vuepress.vuejs.org/zh/) 项目里使用。 + +在项目下的 `/docs/.vuepress` 文件夹下,创建一个 `enhanceApp.js`,按照下面的方式引入即可启动数据上报功能。 + +官方文档传送门:[应用级别的配置 - 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) + +```js +import baiduAnalytics from 'vue-baidu-analytics' + +export default ({ Vue, router }) => { + Vue.use(baiduAnalytics, { + router: router, + siteIdList: [ + 'aaaaaaaaaaaaaaaaaaa', + 'bbbbbbbbbbbbbbbbbbb', + 'ccccccccccccccccccc' + ], + isDebug: false + }); +}; +``` + 可在开发环境打开debug模式了解相关的上报情况(上线前记得关闭debug)。 ## 方法 diff --git a/package.json b/package.json index 059d9df..deb10bd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vue-baidu-analytics", - "version": "2.0.0", - "description": "A data collection tool that supports reporting of single-page application data built by Vue 3.0 & 2.0, based on baidu statistics.", + "version": "2.0.1", + "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.", "main": "dist/vue-baidu-analytics.min.js", "types": "vue-baidu-analytics.d.ts", "scripts": { @@ -16,11 +16,13 @@ "vue baidu", "vue 百度统计", "vue analytics", + "vuepress analytics", "vue 3.0 baidu", "vue 3.0 百度统计", "vue 3.0 analytics", - "spa 3.0 analytics", + "spa analytics", "baidu统计", + "vuepress统计", "百度统计" ], "author": "chengpeiquan",