fuc-new/doc/node_modules/@vuepress/plugin-comment/lib/client/components/WalineComment.js
hellcat 6adbc04d4b 1
2025-10-03 17:17:08 +08:00

3 lines
1.3 KiB
JavaScript

import{useLocale as v,wait as d,LoadingIcon as c}from"@vuepress/helper/client";import{watchImmediate as f}from"@vueuse/core";import{pageviewCount as w}from"@waline/client/pageview";import{defineComponent as C,computed as r,h as a,onMounted as L,nextTick as g,defineAsyncComponent as h}from"vue";import{useData as y,ClientOnly as A}from"vuepress/client";import"@waline/client/waline.css";import"../styles/waline.css";import{c as W}from"../index-C4kzYjlG.js";const E=WALINE_LOCALES;WALINE_META&&import("@waline/client/waline-meta.css");var I=C({name:"WalineComment",props:{identifier:{type:String,required:!0}},setup(t){const{frontmatter:l,lang:u}=y(),e=W(),m=v(E);let n=null;const i=r(()=>!!e.value.serverURL),o=r(()=>i.value&&(l.value.pageview??e.value.pageview??!0)),p=r(()=>({lang:u.value==="zh-CN"?"zh-CN":"en",locale:m.value,dark:"[data-theme='dark']",...e.value,path:t.identifier}));return L(()=>{f(()=>[t.identifier,e.value.serverURL,e.value.delay,o.value],async()=>{n?.(),n=null,o.value&&(await g(),await d(e.value.delay??800),n=w({serverURL:e.value.serverURL,path:t.identifier}))},{flush:"post"})}),()=>i.value?a("div",{id:"comment",class:"waline-wrapper"},a(h({loader:async()=>{const{Waline:s}=await import("@waline/client/component");return()=>a(A,()=>a(s,p.value))},loadingComponent:c}))):null}});export{I as default};
//# sourceMappingURL=WalineComment.js.map