提交 188275e1 编写于 作者: M mehaotian

feat: 新增web百度统计

上级 0ccbc7ee
...@@ -9,6 +9,22 @@ ...@@ -9,6 +9,22 @@
document.write( document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />') (coverSupport ? ', viewport-fit=cover' : '') + '" />')
// 百度统计
// #ifdef WEB
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?167b6301e2b9b0e9830aca70b2eed2bf";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
_hmt.push(['_requirePlugin', 'UrlChangeTracker', {
shouldTrackUrlChange: function(newPath, oldPath) {
return newPath && oldPath;
}
}]);
console.log('加载百度统计');
})();
// #endif
</script> </script>
<title></title> <title></title>
<!--preload-links--> <!--preload-links-->
......
// 仅测试 console.log 时机问题 // 仅测试 console.log 时机问题
import './test-main-console.uts' import './test-main-console.uts'
import { uniStat } from '@/uni_modules/uni-stat/plugin.uts'
import App from './App.uvue' import App from './App.uvue'
import { createSSRApp } from 'vue' import { createSSRApp } from 'vue'
// 统计配置
const collectItems = {
uniStatPageLog: true
}
const statOptions = {
debug: false,
collectItems: collectItems,
}
export function createApp() { export function createApp() {
const app = createSSRApp(App) const app = createSSRApp(App)
app.use(uniStat, statOptions)
// app.mixin({ // app.mixin({
// onReady() { // onReady() {
// setTimeout(() => { // setTimeout(() => {
......
...@@ -416,7 +416,6 @@ export const uni_cloud_config = () : UniCloudInitOptions | null => { ...@@ -416,7 +416,6 @@ export const uni_cloud_config = () : UniCloudInitOptions | null => {
export const get_space = (config : UniCloudInitOptions) : UniCloudInitOptions | null => { export const get_space = (config : UniCloudInitOptions) : UniCloudInitOptions | null => {
const uniCloudConfig = uni_cloud_config() const uniCloudConfig = uni_cloud_config()
if (uniCloudConfig == null) { if (uniCloudConfig == null) {
console.log(config);
// #ifdef APP-ANDROID // #ifdef APP-ANDROID
if (config.spaceId != '') { if (config.spaceId != '') {
return config return config
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册