Release v2.0.1

This commit is contained in:
chengpeiquan 2021-01-08 23:42:51 +08:00
parent 840e3cc8f3
commit 351af146c0
2 changed files with 30 additions and 4 deletions

View File

@ -1,7 +1,7 @@
vue-baidu-analytics 使用说明 vue-baidu-analytics 使用说明
=== ===
基于Vue开发的百度统计插件可以在 `Vue-CLI脚手架项目` 或者 `引入了Vue相关CDN的普通页面` 上使用,使用本插件的项目需要引入 `Vue Router` 基于Vue开发的百度统计插件可以在 `Vue-CLI脚手架项目` 或者 `引入了Vue相关CDN的普通页面`,以及 `VuePress` 项目上使用,使用本插件的项目需要引入 `Vue Router`
> @v2.0版本更新:<br>最新版支持 Vue 3.x同时兼容 Vue 2.x 使用具体使用方法请看下方说明及demo。<br>对Vue 3.0感兴趣,但还在观望的同学,欢迎阅读我踩坑总结的:[Vue 3.0 学习教程](https://vue3.chengpeiquan.com/) 持续更新ing > @v2.0版本更新:<br>最新版支持 Vue 3.x同时兼容 Vue 2.x 使用具体使用方法请看下方说明及demo。<br>对Vue 3.0感兴趣,但还在观望的同学,欢迎阅读我踩坑总结的:[Vue 3.0 学习教程](https://vue3.chengpeiquan.com/) 持续更新ing
@ -104,6 +104,30 @@ createApp(app)
.mount('#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 可在开发环境打开debug模式了解相关的上报情况上线前记得关闭debug
## 方法 ## 方法

View File

@ -1,7 +1,7 @@
{ {
"name": "vue-baidu-analytics", "name": "vue-baidu-analytics",
"version": "2.0.0", "version": "2.0.1",
"description": "A data collection tool that supports reporting of single-page application data built by Vue 3.0 & 2.0, based on baidu statistics.", "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", "main": "dist/vue-baidu-analytics.min.js",
"types": "vue-baidu-analytics.d.ts", "types": "vue-baidu-analytics.d.ts",
"scripts": { "scripts": {
@ -16,11 +16,13 @@
"vue baidu", "vue baidu",
"vue 百度统计", "vue 百度统计",
"vue analytics", "vue analytics",
"vuepress analytics",
"vue 3.0 baidu", "vue 3.0 baidu",
"vue 3.0 百度统计", "vue 3.0 百度统计",
"vue 3.0 analytics", "vue 3.0 analytics",
"spa 3.0 analytics", "spa analytics",
"baidu统计", "baidu统计",
"vuepress统计",
"百度统计" "百度统计"
], ],
"author": "chengpeiquan", "author": "chengpeiquan",