fix: 通用Error组件添加注释
This commit is contained in:
@@ -45,7 +45,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 请求报错样式关于popover的修改 */
|
/* 请求报错样式关于popover的修改 */
|
||||||
.error-hover {
|
.error-popover {
|
||||||
//min-width: 30px !important;
|
//min-width: 30px !important;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background: #FFE7E6 !important;
|
background: #FFE7E6 !important;
|
||||||
|
|||||||
@@ -6,16 +6,15 @@
|
|||||||
placement="top-start"
|
placement="top-start"
|
||||||
trigger="hover"
|
trigger="hover"
|
||||||
:visible-arrow="false"
|
:visible-arrow="false"
|
||||||
class="error-popover"
|
popper-class="error-popover"
|
||||||
popper-class="error-hover"
|
|
||||||
style="background: #1b2e3b !important;"
|
|
||||||
:content="content">
|
:content="content">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<span>
|
<span>
|
||||||
<svg class="icon error-icon" aria-hidden="true">
|
<svg class="icon error-icon" aria-hidden="true">
|
||||||
<use xlink:href="#cn-icon-baocuo"></use>
|
<use xlink:href="#cn-icon-baocuo"></use>
|
||||||
</svg>
|
</svg>
|
||||||
<!-- <i v-if="icon" :class="`one-icon-${icon}`"></i>-->
|
<!-- 为后续自定义icon插槽做预备-->
|
||||||
|
<!-- <i v-if="icon" :class="`icon cn-icon-${icon}`"></i>-->
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
@@ -41,27 +40,47 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<!-- start----------------调用方式----------------start -->
|
||||||
|
<!--
|
||||||
|
组件在全局注册了,调用时: <chart-error :content="content"></chart-error>
|
||||||
|
-->
|
||||||
|
<!--
|
||||||
|
在标题之后显示:<chart-error small :content="content" />
|
||||||
|
-->
|
||||||
|
<!--
|
||||||
|
自定义弹窗宽度:<chart-error small width="300" :content="content" />
|
||||||
|
-->
|
||||||
|
<!--
|
||||||
|
自定义icon图标:<chart-error small icon="baocuo" :content="content" />,此时icon全称为'cn-icon-baocuo'
|
||||||
|
-->
|
||||||
|
<!-- end----------------调用方式----------------end -->
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'Error',
|
name: 'Error',
|
||||||
props: {
|
props: {
|
||||||
|
// 模块标识,small即标题之后出现icon图标,鼠标移入显示报错信息,非small即在div内显示报错信息
|
||||||
small: {
|
small: {
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
|
// 报错信息内容,如果不传,默认为"Error"
|
||||||
content: {
|
content: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'Error!'
|
default: 'Error!'
|
||||||
},
|
},
|
||||||
|
// 报错信息模块宽度,如果选择small,则为弹窗宽度
|
||||||
width: {
|
width: {
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
|
// 报错信息模块最大宽度
|
||||||
maxWidth: {
|
maxWidth: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '350'
|
default: '350'
|
||||||
},
|
},
|
||||||
|
// 自定义icon图标
|
||||||
icon: {
|
icon: {
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
|
// 自定义svg图标
|
||||||
svg: {
|
svg: {
|
||||||
type: String
|
type: String
|
||||||
}
|
}
|
||||||
@@ -87,10 +106,12 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.width) {
|
if (this.width) {
|
||||||
|
// 避免宽度出现负数的情况
|
||||||
this.localWidth = Math.abs(parseFloat(this.width)) + 'px'
|
this.localWidth = Math.abs(parseFloat(this.width)) + 'px'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.maxWidth) {
|
if (this.maxWidth) {
|
||||||
|
// 避免宽度出现负数的情况
|
||||||
this.localMaxWidth = Math.abs(parseFloat(this.maxWidth)) + 'px'
|
this.localMaxWidth = Math.abs(parseFloat(this.maxWidth)) + 'px'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user