chore: commit时格式整理
This commit is contained in:
@@ -25,13 +25,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
.layui-backtop-medium{
|
||||
.layui-backtop-medium {
|
||||
width: @width - 10px;
|
||||
height: @height - 10px;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.layui-backtop-small{
|
||||
.layui-backtop-small {
|
||||
width: @width - 20px;
|
||||
height: @height - 20px;
|
||||
font-size: 20px;
|
||||
|
||||
@@ -5,4 +5,4 @@ Component.install = (app: App) => {
|
||||
app.component(Component.name, Component);
|
||||
};
|
||||
|
||||
export default Component;
|
||||
export default Component;
|
||||
|
||||
@@ -5,13 +5,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
ref,
|
||||
shallowRef,
|
||||
withDefaults,
|
||||
computed,
|
||||
onMounted,
|
||||
} from "vue";
|
||||
import { ref, shallowRef, withDefaults, computed, onMounted } from "vue";
|
||||
import LayIcon from "../icon/index";
|
||||
import "./index.less";
|
||||
|
||||
@@ -50,15 +44,15 @@ let visible = ref(props.showHeight === 0);
|
||||
|
||||
const classBacktop = computed(() => {
|
||||
return {
|
||||
'layui-backtop-medium': props.size === "medium",
|
||||
'layui-backtop-small': props.size === "small"
|
||||
}
|
||||
"layui-backtop-medium": props.size === "medium",
|
||||
"layui-backtop-small": props.size === "small",
|
||||
};
|
||||
});
|
||||
|
||||
const borderRadius = computed(() => {
|
||||
if (props.circle) {
|
||||
return "50%"
|
||||
};
|
||||
return "50%";
|
||||
}
|
||||
return typeof props.borderRadius === "number"
|
||||
? `${props.borderRadius}px`
|
||||
: props.borderRadius;
|
||||
@@ -132,13 +126,15 @@ const getScrollTarget = () => {
|
||||
return getScrollParent(backtopRef.value!, false);
|
||||
} else {
|
||||
const targetElement = document.querySelector<HTMLElement>(props.target);
|
||||
if (!targetElement){
|
||||
if (!targetElement) {
|
||||
throw new Error(`target is not existed: ${props.target}`);
|
||||
}
|
||||
// 特定容器内部显示
|
||||
if (props.position === "absolute") {
|
||||
if (!targetElement.parentElement){
|
||||
throw new Error( `target parent element is not existed: ${props.target}`);
|
||||
if (!targetElement.parentElement) {
|
||||
throw new Error(
|
||||
`target parent element is not existed: ${props.target}`
|
||||
);
|
||||
}
|
||||
targetElement.parentElement.style.position = "relative";
|
||||
// backtopRef.value!.style.position = props.position;
|
||||
@@ -163,7 +159,9 @@ const getScrollParent = (
|
||||
if (excludeStaticParent && style.position === "static") {
|
||||
continue;
|
||||
}
|
||||
if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX)){
|
||||
if (
|
||||
overflowRegex.test(style.overflow + style.overflowY + style.overflowX)
|
||||
) {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
@@ -209,4 +207,4 @@ onMounted(() => {
|
||||
/>
|
||||
</slot>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user