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

feat: 新增web百度统计

上级 0ccbc7ee
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<!--本文件为编译到web专用文件--> <!--本文件为编译到web专用文件-->
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<script> <script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)')) CSS.supports('top: constant(a)'))
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' : '') + '" />')
</script> // 百度统计
<title></title> // #ifdef WEB
<!--preload-links--> var _hmt = _hmt || [];
<!--app-context--> (function() {
</head> var hm = document.createElement("script");
<body> hm.src = "https://hm.baidu.com/hm.js?167b6301e2b9b0e9830aca70b2eed2bf";
<div id="app"><!--app-html--></div> var s = document.getElementsByTagName("script")[0];
<script type="module" src="/main"></script> s.parentNode.insertBefore(hm, s);
</body> _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> </html>
// 仅测试 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.
先完成此消息的编辑!
想要评论请 注册