feat: 初始化
This commit is contained in:
commit
ef8081b838
64 files changed
+2137
No files matched your search
@@ -0,0 +1,39 @@
|
||||
<script setup lang="ts" name="IconAndText">
|
||||
import { computed } from "vue";
|
||||
|
||||
const props = defineProps<{
|
||||
icon?: string;
|
||||
text?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
}>();
|
||||
|
||||
const defaultIcon = new URL("../../assets/svg/failed.svg", import.meta.url).href;
|
||||
const defaultText = "抱歉,出现意外错误了";
|
||||
const viewportWidth = 375;
|
||||
const unit = "vw";
|
||||
|
||||
const pxToVw = (val:number) => {
|
||||
return viewportWidth/100 * val + unit;
|
||||
};
|
||||
|
||||
const iconStyle = computed(() => {
|
||||
let str = "";
|
||||
if (props.width) str += "width:" + pxToVw(props.width);
|
||||
if (props.height) {
|
||||
str += props.width ? ";" : "";
|
||||
str += "height:" + pxToVw(props.height);
|
||||
}
|
||||
return str;
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="xtbg-tips-page-image" :style="iconStyle">
|
||||
<img :src="icon || defaultIcon">
|
||||
</div>
|
||||
<div class="xtbg-tips-page-text">
|
||||
<p>{{ text || defaultText }}</p>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user