fix(docs): 优化获取版本

This commit is contained in:
sight 2022-03-31 13:38:12 +08:00
parent bda6d44997
commit da148ac779

View File

@ -257,10 +257,17 @@ export default {
}); });
const latestVer = getLayuiVueVersion(); const latestVer = getLayuiVueVersion();
const layuiVueVersion = computed(() => const layuiVueVersion = computed(() => {
latestVer.value if(!latestVer.value){
?? import.meta.env.LAYUI_VUE_VERSION const ver = import.meta.env.LAYUI_VUE_VERSION;
) const idx = ver.indexOf("-");
const isPreRelease = (idx != -1);
if(isPreRelease){
latestVer.value = ver.substring(0, idx)
}
}
return latestVer.value;
})
watch(isDark, () => { watch(isDark, () => {
if (isDark.value) { if (isDark.value) {
@ -286,9 +293,9 @@ export default {
locale.value = lang; locale.value = lang;
}; };
provide('LayuiVueVersion', layuiVueVersion)
provide("isDark",isDark); provide("isDark",isDark);
provide("theme",theme); provide("theme",theme);
provide('LayuiVueVersion', layuiVueVersion);
return { return {
t, t,