fix:修复打包失败的问题
This commit is contained in:
@@ -16,6 +16,11 @@ export default withMermaid({
|
||||
lang: "zh-CN",
|
||||
},
|
||||
},
|
||||
vite: {
|
||||
ssr: {
|
||||
noExternal: ['vue3-calendar-heatmap']
|
||||
}
|
||||
},
|
||||
themeConfig: {
|
||||
logo: "/logo.png",
|
||||
// https://vitepress.dev/reference/default-theme-config
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, onMounted, watch } from 'vue'
|
||||
import { countWord } from '../utils/functions'
|
||||
import { countWord } from '../utils'
|
||||
import { useData } from 'vitepress'
|
||||
|
||||
const wordCount = ref(0)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<calendar-heatmap
|
||||
v-if="!isMobile()"
|
||||
:values="heatmapData"
|
||||
:end-date="new Date()"
|
||||
no-data-text="暂无记录"
|
||||
@@ -19,6 +20,7 @@
|
||||
import { CalendarHeatmap } from 'vue3-calendar-heatmap';
|
||||
import 'vue3-calendar-heatmap/dist/style.css';
|
||||
import { data } from '../../data/posts.data.js'
|
||||
import {isMobile} from "../utils";
|
||||
|
||||
const dateCountMap = new Map<string, number>();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const pattern
|
||||
= /[a-zA-Z0-9_\u0392-\u03C9\u00C0-\u00FF\u0600-\u06FF\u0400-\u04FF]+|[\u4E00-\u9FFF\u3400-\u4DBF\uF900-\uFAFF\u3040-\u309F\uAC00-\uD7AF]+/g
|
||||
|
||||
export function countWord(data: string) {
|
||||
export const countWord = (data: string)=> {
|
||||
const m = data.match(pattern)
|
||||
let count = 0
|
||||
if (!m) {
|
||||
@@ -17,3 +17,17 @@ export function countWord(data: string) {
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为移动端
|
||||
*/
|
||||
export const isMobile = (): boolean => {
|
||||
if (typeof window === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const userAgent = navigator.userAgent;
|
||||
const mobileRegex = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
|
||||
|
||||
return mobileRegex.test(userAgent);
|
||||
}
|
||||
Reference in New Issue
Block a user