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

feat: 新增web百度统计

上级 0ccbc7ee
<!DOCTYPE html>
<html lang="en">
<!--本文件为编译到web专用文件-->
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<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' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main"></script>
</body>
<!DOCTYPE html>
<html lang="en">
<!--本文件为编译到web专用文件-->
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<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' : '') + '" />')
// 百度统计
// #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>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main"></script>
</body>
</html>
// 仅测试 console.log 时机问题
import './test-main-console.uts'
import { uniStat } from '@/uni_modules/uni-stat/plugin.uts'
import App from './App.uvue'
import { createSSRApp } from 'vue'
// 统计配置
const collectItems = {
uniStatPageLog: true
}
const statOptions = {
debug: false,
collectItems: collectItems,
}
export function createApp() {
const app = createSSRApp(App)
app.use(uniStat, statOptions)
// app.mixin({
// onReady() {
// setTimeout(() => {
......
......@@ -416,7 +416,6 @@ export const uni_cloud_config = () : UniCloudInitOptions | null => {
export const get_space = (config : UniCloudInitOptions) : UniCloudInitOptions | null => {
const uniCloudConfig = uni_cloud_config()
if (uniCloudConfig == null) {
console.log(config);
// #ifdef APP-ANDROID
if (config.spaceId != '') {
return config
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册