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 layuiVueVersion = computed(() =>
latestVer.value
?? import.meta.env.LAYUI_VUE_VERSION
)
const layuiVueVersion = computed(() => {
if(!latestVer.value){
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, () => {
if (isDark.value) {
@ -286,9 +293,9 @@ export default {
locale.value = lang;
};
provide('LayuiVueVersion', layuiVueVersion)
provide("isDark",isDark);
provide("theme",theme);
provide('LayuiVueVersion', layuiVueVersion);
return {
t,