sh-view 1.7.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +20 -21
- package/package.json +10 -10
- package/packages/assets/css/animated.scss +167 -2
- package/packages/assets/css/loader.scss +42 -42
- package/packages/assets/css/main.scss +41 -21
- package/packages/assets/css/theme.scss +83 -44
- package/packages/components/global-components/sh-alert/index.vue +173 -0
- package/packages/components/global-components/sh-badge/index.vue +227 -0
- package/packages/components/global-components/sh-card/index.vue +140 -122
- package/packages/components/global-components/sh-code-editor/index.vue +260 -260
- package/packages/components/global-components/sh-col/css/index.scss +76 -0
- package/packages/components/global-components/sh-col/index.vue +83 -0
- package/packages/components/global-components/sh-corner/index.vue +1 -9
- package/packages/components/global-components/sh-count-to/index.vue +102 -46
- package/packages/components/global-components/sh-date/index.vue +40 -0
- package/packages/components/global-components/sh-drawer/index.vue +518 -0
- package/packages/components/global-components/sh-drawer/scrollbar.js +76 -0
- package/packages/components/global-components/sh-empty/index.vue +43 -43
- package/packages/components/global-components/{sh-vxe-form → sh-form}/css/index.scss +6 -6
- package/packages/components/global-components/{sh-vxe-form → sh-form}/index.vue +114 -115
- package/packages/components/global-components/{sh-vxe-form → sh-form}/js/methods.js +146 -157
- package/packages/components/global-components/{sh-vxe-form → sh-form}/mixin/defaultData.js +32 -33
- package/packages/components/global-components/sh-header/index.vue +293 -269
- package/packages/components/global-components/sh-icon/css/default/fonts/ionicons.svg +870 -0
- package/packages/components/global-components/sh-icon/css/default/fonts/ionicons.ttf +0 -0
- package/packages/components/global-components/sh-icon/css/default/fonts/ionicons.woff +0 -0
- package/packages/components/global-components/sh-icon/css/default/fonts/ionicons.woff2 +0 -0
- package/packages/components/global-components/sh-icon/css/default/icons.scss +2583 -0
- package/packages/components/global-components/sh-icon/css/default/index.scss +27 -0
- package/packages/components/global-components/sh-icon/css/font/fonts/iconfont.js +1 -0
- package/packages/components/global-components/sh-icon/css/font/fonts/iconfont.json +247 -0
- package/packages/components/global-components/sh-icon/css/font/fonts/iconfont.ttf +0 -0
- package/packages/components/global-components/sh-icon/css/font/fonts/iconfont.woff +0 -0
- package/packages/components/global-components/sh-icon/css/font/fonts/iconfont.woff2 +0 -0
- package/packages/components/global-components/sh-icon/css/font/icons.scss +135 -0
- package/packages/components/global-components/sh-icon/css/font/index.scss +16 -0
- package/packages/components/global-components/sh-icon/icon-default.vue +32 -0
- package/packages/components/global-components/sh-icon/{icons.vue → icon-font.vue} +32 -32
- package/packages/components/global-components/sh-icon/index.vue +28 -27
- package/packages/components/global-components/sh-image/index.vue +123 -0
- package/packages/components/global-components/sh-list/index.vue +141 -0
- package/packages/components/global-components/sh-loading/index.vue +49 -42
- package/packages/components/global-components/{sh-vxe-modal → sh-modal}/index.vue +209 -209
- package/packages/components/global-components/sh-noticebar/index.vue +201 -201
- package/packages/components/global-components/sh-poptip/index.vue +479 -0
- package/packages/components/global-components/sh-poptip/popper.js +115 -0
- package/packages/components/global-components/sh-progress/index.vue +290 -0
- package/packages/components/global-components/sh-pull-refresh/index.vue +290 -290
- package/packages/components/global-components/{sh-vxe-query → sh-query}/index.vue +317 -310
- package/packages/components/global-components/sh-result/index.vue +110 -88
- package/packages/components/global-components/sh-row/css/index.scss +21 -0
- package/packages/components/global-components/sh-row/index.vue +63 -0
- package/packages/components/global-components/sh-split/components/trigger.vue +33 -0
- package/packages/components/global-components/sh-split/index.vue +334 -142
- package/packages/components/global-components/sh-table/components/importModal.vue +351 -0
- package/packages/components/global-components/{sh-vxe-table → sh-table}/css/index.scss +4 -22
- package/packages/components/global-components/{sh-vxe-table → sh-table}/index.vue +329 -351
- package/packages/components/global-components/{sh-vxe-table → sh-table}/js/methods.js +33 -88
- package/packages/components/global-components/{sh-vxe-table → sh-table}/js/props.js +304 -313
- package/packages/components/global-components/{sh-vxe-table → sh-table}/mixin/defaultData.js +94 -116
- package/packages/components/global-components/sh-tabs/index.vue +315 -0
- package/packages/components/global-components/sh-tag/index.vue +163 -0
- package/packages/components/global-components/{sh-vxe-toolbar → sh-toolbar}/index.vue +177 -172
- package/packages/components/global-components/sh-tree/components/table-tree.vue +280 -0
- package/packages/components/global-components/sh-tree/css/index.scss +54 -0
- package/packages/components/global-components/sh-tree/index.vue +195 -0
- package/packages/components/global-components/sh-tree/mixin/treeProps.js +124 -0
- package/packages/components/global-components/sh-upload/index.vue +278 -275
- package/packages/components/global-components/sh-water-fall/index.vue +87 -87
- package/packages/components/index.js +85 -59
- package/packages/components/other-components/sh-cron-modal/css/index.scss +2 -2
- package/packages/components/other-components/sh-menu-card/index.vue +224 -224
- package/packages/css/index.js +4 -6
- package/packages/directive/index.js +19 -19
- package/packages/directive/module/click-out.js +14 -0
- package/packages/directive/module/draggable.js +42 -42
- package/packages/directive/module/line-clamp.js +22 -0
- package/packages/directive/module/prevent-click.js +18 -0
- package/packages/directive/module/resize.js +19 -0
- package/packages/directive/module/ripple.js +166 -0
- package/packages/index.js +39 -40
- package/packages/utils/transfer-queue.js +12 -0
- package/packages/vxeTable/css/index.scss +12 -98
- package/packages/vxeTable/css/variable.scss +7 -265
- package/packages/vxeTable/index.js +184 -183
- package/packages/vxeTable/plugins/export.js +450 -0
- package/packages/vxeTable/render/cell/vxe-render-checkgroup.vue +36 -36
- package/packages/vxeTable/render/cell/vxe-render-goption.vue +94 -93
- package/packages/vxeTable/render/cell/vxe-render-img.vue +21 -28
- package/packages/vxeTable/render/cell/vxe-render-input.vue +51 -51
- package/packages/vxeTable/render/cell/vxe-render-progress.vue +19 -19
- package/packages/vxeTable/render/cell/vxe-render-radiogroup.vue +36 -36
- package/packages/vxeTable/render/cell/vxe-render-select.vue +36 -36
- package/packages/vxeTable/render/cell/vxe-render-tree.vue +59 -59
- package/packages/vxeTable/render/globalRenders.jsx +498 -491
- package/packages/assets/icons/demo.css +0 -539
- package/packages/assets/icons/iconfont.css +0 -415
- package/packages/assets/icons/iconfont.js +0 -1
- package/packages/assets/icons/iconfont.json +0 -709
- package/packages/assets/icons/iconfont.ttf +0 -0
- package/packages/assets/icons/iconfont.woff +0 -0
- package/packages/assets/icons/iconfont.woff2 +0 -0
- package/packages/assets/img/image-error.png +0 -0
- package/packages/assets/img/square-image.png +0 -0
- package/packages/components/global-components/sh-iv-form/components/iv-group-item.vue +0 -57
- package/packages/components/global-components/sh-iv-form/components/iv-single-item.vue +0 -76
- package/packages/components/global-components/sh-iv-form/index.vue +0 -255
- package/packages/components/global-components/sh-vxe-list/index.vue +0 -149
- package/packages/components/global-components/sh-vxe-table/components/importModal.vue +0 -377
- package/packages/components/global-components/sh-vxe-tree/components/table-tree.vue +0 -233
- package/packages/components/global-components/sh-vxe-tree/css/index.scss +0 -20
- package/packages/components/global-components/sh-vxe-tree/index.vue +0 -85
- package/packages/components/global-components/sh-vxe-tree/js/props.js +0 -120
- package/packages/components/global-components/sh-vxe-tree/js/treeMethods.js +0 -169
- package/packages/components/global-components/sh-vxe-tree/mixin/defaultData.js +0 -54
- package/packages/components/global-components/sh-vxe-tree/vxe-direct-tree.vue +0 -203
- package/packages/components/global-components/sh-vxe-tree/vxe-select-tree.vue +0 -291
- package/packages/components/other-components/sh-markdown/tinymce/langs/ar.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/az.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/bg_BG.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/bn_BD.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ca.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/cs.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/cy.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/da.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/de.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/dv.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/el.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/eo.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/es.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/es_MX.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/et.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/eu.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/fa.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/fi.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/fr_FR.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ga.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/gl.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/he_IL.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/hi.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/hr.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/hu_HU.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/hy.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/id.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/is_IS.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/it.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ja.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/kab.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/kk.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ko_KR.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ku.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/lt.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/lv.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/nb_NO.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ne.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/nl.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/nl_BE.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/oc.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/pl.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/pt_BR.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ro.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ru.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/sk.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/sl_SI.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/sq.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/sr.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/sv_SE.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ta.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/tg.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/th_TH.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/tr.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/ug.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/uk.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/langs/vi.js +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/dark/content.css +0 -72
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/dark/content.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/default/content.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/document/content.css +0 -72
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/document/content.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/writer/content.css +0 -68
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/writer/content.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.css +0 -714
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.inline.css +0 -726
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.inline.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.mobile.css +0 -29
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.mobile.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/fonts/tinymce-mobile.woff +0 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.css +0 -3047
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.mobile.css +0 -673
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.mobile.min.css +0 -7
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +0 -37
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +0 -7
- package/packages/directive/directives.js +0 -27
- package/packages/iview/css/index.scss +0 -32
- package/packages/iview/index.js +0 -25
- /package/packages/components/global-components/{sh-vxe-form → sh-form}/components/form-item.vue +0 -0
- /package/packages/components/global-components/{sh-vxe-form → sh-form}/js/props.js +0 -0
- /package/packages/components/global-components/{sh-vxe-table → sh-table}/js/excel_to_json.js +0 -0
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div v-if="isShow" class="sh-notice-bar" :class="[round && 'sh-notice-bar-round', type]" :style="styles">
|
|
3
|
-
<div class="sh-notice-bar-left" :class="[!customLeft && !icon && 'sh-notice-bar-empty']">
|
|
4
|
-
<template v-if="customLeft">
|
|
5
|
-
<slot name="left"></slot>
|
|
6
|
-
</template>
|
|
7
|
-
<template v-else-if="icon">
|
|
8
|
-
<sh-icon class="sh-notice-icon" :type="icon" size="20" />
|
|
9
|
-
</template>
|
|
10
|
-
</div>
|
|
11
|
-
<div ref="wrap" class="sh-notice-bar-content" :class="[multiRows && 'sh-notice-bar-multi-content']">
|
|
12
|
-
<div ref="content" :class="[overflow && scrollable && 'sh-notice-bar-content-animate']" :style="animateStyles">
|
|
13
|
-
<slot></slot>
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
<div class="sh-notice-bar-right">
|
|
17
|
-
<template v-if="customRight">
|
|
18
|
-
<slot name="right"></slot>
|
|
19
|
-
</template>
|
|
20
|
-
<template v-else-if="mode || closable">
|
|
21
|
-
<sh-icon class="sh-notice-icon sh-notice-icon-right" :type="rightIcon" size="20" @click.stop="noticebarClose" />
|
|
22
|
-
</template>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</template>
|
|
26
|
-
|
|
27
|
-
<script>
|
|
28
|
-
export default {
|
|
29
|
-
name: '
|
|
30
|
-
components: {},
|
|
31
|
-
props: {
|
|
32
|
-
mode: {
|
|
33
|
-
type: String,
|
|
34
|
-
default: ''
|
|
35
|
-
},
|
|
36
|
-
type: {
|
|
37
|
-
type: String,
|
|
38
|
-
default: 'default' // default/activity/warning
|
|
39
|
-
},
|
|
40
|
-
color: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: '#1890ff'
|
|
43
|
-
},
|
|
44
|
-
time: {
|
|
45
|
-
type: Number,
|
|
46
|
-
default: 0
|
|
47
|
-
},
|
|
48
|
-
round: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
default: false
|
|
51
|
-
},
|
|
52
|
-
multiRows: {
|
|
53
|
-
type: Boolean,
|
|
54
|
-
default: false
|
|
55
|
-
},
|
|
56
|
-
scrollable: {
|
|
57
|
-
type: Boolean,
|
|
58
|
-
default: false
|
|
59
|
-
},
|
|
60
|
-
icon: {
|
|
61
|
-
type: String,
|
|
62
|
-
default: ''
|
|
63
|
-
},
|
|
64
|
-
closable: {
|
|
65
|
-
type: Boolean,
|
|
66
|
-
default: false
|
|
67
|
-
},
|
|
68
|
-
speed: {
|
|
69
|
-
type: Number,
|
|
70
|
-
default: 50
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
emits: ['close'],
|
|
74
|
-
data() {
|
|
75
|
-
return {
|
|
76
|
-
isShow: true,
|
|
77
|
-
overflow: false
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
computed: {
|
|
81
|
-
styles() {
|
|
82
|
-
return {
|
|
83
|
-
color: this.color,
|
|
84
|
-
backgroundColor: this.$vUtils.fade(this.color, 30)
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
animateStyles() {
|
|
88
|
-
return {
|
|
89
|
-
animationDuration: this.speed + 's'
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
customLeft() {
|
|
93
|
-
return Boolean(this.$slots.left)
|
|
94
|
-
},
|
|
95
|
-
customRight() {
|
|
96
|
-
return Boolean(this.$slots.right)
|
|
97
|
-
},
|
|
98
|
-
rightIcon() {
|
|
99
|
-
return this.mode === 'link' ? 'ios-arrow-forward' : 'md-close'
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
watch: {},
|
|
103
|
-
updated() {
|
|
104
|
-
this.noticebarCheckOverflow()
|
|
105
|
-
},
|
|
106
|
-
mounted() {
|
|
107
|
-
if (this.time) {
|
|
108
|
-
this.noticebarHide(this.time)
|
|
109
|
-
}
|
|
110
|
-
this.noticebarCheckOverflow()
|
|
111
|
-
},
|
|
112
|
-
methods: {
|
|
113
|
-
noticebarHide(time) {
|
|
114
|
-
setTimeout(() => {
|
|
115
|
-
this.isShow = false
|
|
116
|
-
}, time)
|
|
117
|
-
},
|
|
118
|
-
noticebarClose() {
|
|
119
|
-
if (this.mode === 'closable' || this.closable) {
|
|
120
|
-
this.isShow = false
|
|
121
|
-
}
|
|
122
|
-
this.$emit('close')
|
|
123
|
-
},
|
|
124
|
-
noticebarCheckOverflow() {
|
|
125
|
-
if (!this.scrollable) {
|
|
126
|
-
return
|
|
127
|
-
}
|
|
128
|
-
const { wrap, content } = this.$refs
|
|
129
|
-
if (!wrap || !content) {
|
|
130
|
-
return
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* 计算 padding-left 对宽度的影响
|
|
134
|
-
* 替换 clientWidth 为 getBoundingClientRect
|
|
135
|
-
*/
|
|
136
|
-
const paddingLeft = window.getComputedStyle(content, null).getPropertyValue('padding').split(' ')[3] || '0px'
|
|
137
|
-
const left = Number(paddingLeft.match(/\d+/g)[0])
|
|
138
|
-
this.overflow = content.scrollWidth - left > Math.ceil(wrap.getBoundingClientRect().width)
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
</script>
|
|
143
|
-
|
|
144
|
-
<style lang="scss" scoped>
|
|
145
|
-
.sh-notice-bar {
|
|
146
|
-
display: flex;
|
|
147
|
-
background-color: rgba(0, 0, 0, 0.05);
|
|
148
|
-
color: inherit;
|
|
149
|
-
position: relative;
|
|
150
|
-
z-index: 15;
|
|
151
|
-
padding: 10px 0 10px 15px;
|
|
152
|
-
box-sizing: border-box;
|
|
153
|
-
&.sh-notice-bar-round {
|
|
154
|
-
border-radius: 6px;
|
|
155
|
-
}
|
|
156
|
-
.sh-notice-icon {
|
|
157
|
-
cursor: pointer;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
.sh-notice-bar-left,
|
|
161
|
-
.sh-notice-bar-right {
|
|
162
|
-
display: flex;
|
|
163
|
-
align-items: center;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.sh-notice-bar-left {
|
|
167
|
-
padding-right: 10px;
|
|
168
|
-
}
|
|
169
|
-
.sh-notice-bar-right {
|
|
170
|
-
padding: 0 10px;
|
|
171
|
-
}
|
|
172
|
-
.sh-notice-bar-empty {
|
|
173
|
-
padding-right: 0;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.sh-notice-bar-content {
|
|
177
|
-
flex: 1;
|
|
178
|
-
margin: auto;
|
|
179
|
-
width: auto;
|
|
180
|
-
white-space: nowrap;
|
|
181
|
-
overflow: hidden;
|
|
182
|
-
&.sh-notice-bar-multi-content {
|
|
183
|
-
padding: 0;
|
|
184
|
-
line-height: 1.5;
|
|
185
|
-
white-space: normal;
|
|
186
|
-
}
|
|
187
|
-
.sh-notice-bar-content-animate {
|
|
188
|
-
padding-left: 100%;
|
|
189
|
-
display: inline-block;
|
|
190
|
-
animation: sh-notice-bar-animation linear 30s infinite both;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
@keyframes sh-notice-bar-animation {
|
|
194
|
-
0% {
|
|
195
|
-
transform: translate3d(0, 0, 0);
|
|
196
|
-
}
|
|
197
|
-
100% {
|
|
198
|
-
transform: translate3d(-100%, 0, 0);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="isShow" class="sh-notice-bar" :class="[round && 'sh-notice-bar-round', type]" :style="styles">
|
|
3
|
+
<div class="sh-notice-bar-left" :class="[!customLeft && !icon && 'sh-notice-bar-empty']">
|
|
4
|
+
<template v-if="customLeft">
|
|
5
|
+
<slot name="left"></slot>
|
|
6
|
+
</template>
|
|
7
|
+
<template v-else-if="icon">
|
|
8
|
+
<sh-icon class="sh-notice-icon" :type="icon" size="20" />
|
|
9
|
+
</template>
|
|
10
|
+
</div>
|
|
11
|
+
<div ref="wrap" class="sh-notice-bar-content" :class="[multiRows && 'sh-notice-bar-multi-content']">
|
|
12
|
+
<div ref="content" :class="[overflow && scrollable && 'sh-notice-bar-content-animate']" :style="animateStyles">
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="sh-notice-bar-right">
|
|
17
|
+
<template v-if="customRight">
|
|
18
|
+
<slot name="right"></slot>
|
|
19
|
+
</template>
|
|
20
|
+
<template v-else-if="mode || closable">
|
|
21
|
+
<sh-icon class="sh-notice-icon sh-notice-icon-right" :type="rightIcon" size="20" @click.stop="noticebarClose" />
|
|
22
|
+
</template>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
export default {
|
|
29
|
+
name: 'ShNoticebar',
|
|
30
|
+
components: {},
|
|
31
|
+
props: {
|
|
32
|
+
mode: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: ''
|
|
35
|
+
},
|
|
36
|
+
type: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'default' // default/activity/warning
|
|
39
|
+
},
|
|
40
|
+
color: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: '#1890ff'
|
|
43
|
+
},
|
|
44
|
+
time: {
|
|
45
|
+
type: Number,
|
|
46
|
+
default: 0
|
|
47
|
+
},
|
|
48
|
+
round: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
51
|
+
},
|
|
52
|
+
multiRows: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
scrollable: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: false
|
|
59
|
+
},
|
|
60
|
+
icon: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: ''
|
|
63
|
+
},
|
|
64
|
+
closable: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: false
|
|
67
|
+
},
|
|
68
|
+
speed: {
|
|
69
|
+
type: Number,
|
|
70
|
+
default: 50
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
emits: ['close'],
|
|
74
|
+
data() {
|
|
75
|
+
return {
|
|
76
|
+
isShow: true,
|
|
77
|
+
overflow: false
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
computed: {
|
|
81
|
+
styles() {
|
|
82
|
+
return {
|
|
83
|
+
color: this.color,
|
|
84
|
+
backgroundColor: this.$vUtils.fade(this.color, 30)
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
animateStyles() {
|
|
88
|
+
return {
|
|
89
|
+
animationDuration: this.speed + 's'
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
customLeft() {
|
|
93
|
+
return Boolean(this.$slots.left)
|
|
94
|
+
},
|
|
95
|
+
customRight() {
|
|
96
|
+
return Boolean(this.$slots.right)
|
|
97
|
+
},
|
|
98
|
+
rightIcon() {
|
|
99
|
+
return this.mode === 'link' ? 'ios-arrow-forward' : 'md-close'
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
watch: {},
|
|
103
|
+
updated() {
|
|
104
|
+
this.noticebarCheckOverflow()
|
|
105
|
+
},
|
|
106
|
+
mounted() {
|
|
107
|
+
if (this.time) {
|
|
108
|
+
this.noticebarHide(this.time)
|
|
109
|
+
}
|
|
110
|
+
this.noticebarCheckOverflow()
|
|
111
|
+
},
|
|
112
|
+
methods: {
|
|
113
|
+
noticebarHide(time) {
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
this.isShow = false
|
|
116
|
+
}, time)
|
|
117
|
+
},
|
|
118
|
+
noticebarClose() {
|
|
119
|
+
if (this.mode === 'closable' || this.closable) {
|
|
120
|
+
this.isShow = false
|
|
121
|
+
}
|
|
122
|
+
this.$emit('close')
|
|
123
|
+
},
|
|
124
|
+
noticebarCheckOverflow() {
|
|
125
|
+
if (!this.scrollable) {
|
|
126
|
+
return
|
|
127
|
+
}
|
|
128
|
+
const { wrap, content } = this.$refs
|
|
129
|
+
if (!wrap || !content) {
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 计算 padding-left 对宽度的影响
|
|
134
|
+
* 替换 clientWidth 为 getBoundingClientRect
|
|
135
|
+
*/
|
|
136
|
+
const paddingLeft = window.getComputedStyle(content, null).getPropertyValue('padding').split(' ')[3] || '0px'
|
|
137
|
+
const left = Number(paddingLeft.match(/\d+/g)[0])
|
|
138
|
+
this.overflow = content.scrollWidth - left > Math.ceil(wrap.getBoundingClientRect().width)
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
</script>
|
|
143
|
+
|
|
144
|
+
<style lang="scss" scoped>
|
|
145
|
+
.sh-notice-bar {
|
|
146
|
+
display: flex;
|
|
147
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
148
|
+
color: inherit;
|
|
149
|
+
position: relative;
|
|
150
|
+
z-index: 15;
|
|
151
|
+
padding: 10px 0 10px 15px;
|
|
152
|
+
box-sizing: border-box;
|
|
153
|
+
&.sh-notice-bar-round {
|
|
154
|
+
border-radius: 6px;
|
|
155
|
+
}
|
|
156
|
+
.sh-notice-icon {
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
.sh-notice-bar-left,
|
|
161
|
+
.sh-notice-bar-right {
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.sh-notice-bar-left {
|
|
167
|
+
padding-right: 10px;
|
|
168
|
+
}
|
|
169
|
+
.sh-notice-bar-right {
|
|
170
|
+
padding: 0 10px;
|
|
171
|
+
}
|
|
172
|
+
.sh-notice-bar-empty {
|
|
173
|
+
padding-right: 0;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.sh-notice-bar-content {
|
|
177
|
+
flex: 1;
|
|
178
|
+
margin: auto;
|
|
179
|
+
width: auto;
|
|
180
|
+
white-space: nowrap;
|
|
181
|
+
overflow: hidden;
|
|
182
|
+
&.sh-notice-bar-multi-content {
|
|
183
|
+
padding: 0;
|
|
184
|
+
line-height: 1.5;
|
|
185
|
+
white-space: normal;
|
|
186
|
+
}
|
|
187
|
+
.sh-notice-bar-content-animate {
|
|
188
|
+
padding-left: 100%;
|
|
189
|
+
display: inline-block;
|
|
190
|
+
animation: sh-notice-bar-animation linear 30s infinite both;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
@keyframes sh-notice-bar-animation {
|
|
194
|
+
0% {
|
|
195
|
+
transform: translate3d(0, 0, 0);
|
|
196
|
+
}
|
|
197
|
+
100% {
|
|
198
|
+
transform: translate3d(-100%, 0, 0);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
</style>
|