UNPKG

@mucfe/matui

Version:

基于Vue和ElementUi的PC组件库

169 lines (168 loc) 3.01 kB
import { isString, isObject, formatFontSize } from 'mat-ui/src/utils/helpers' const EVENT_TIPS_CLICK = 'tipsclick' export default { props: { visible: { type: Boolean, default: true }, tit: { type: String, default: '' }, subTit: { type: String, default: '' }, eleType: { type: Number, default: 0 }, tips: { type: [String, Object], default: '' }, remarks: { type: String, default: '' }, errMsg: { type: String, default: '' }, value: { type: [String, Object, Number, Array], default: undefined }, desc: { type: [String, Number], default: '' }, type: { type: String, default: 'text' }, placeholder: { type: String, default: '' }, unit: { type: String, default: '' }, options: { type: Array, default () { return [] } }, range: { type: Object, default () { return { conMin: 1, conMax: 1, min: 1, max: 1000, step: 1 } } }, displayRatio: { type: Number, default: 1 }, fontSize: { type: [String, Number], default: '' }, color: { type: String, default: '' }, rows: { type: [String, Number], default: 1 }, align: { type: String, default: 'right' }, colons: { type: Boolean, default: false }, border: { type: String, default: 'none' }, titPadding: { type: Boolean, default: false }, zIndex: { type: Number, default: 100 }, brandColor: { type: String, default: '#8c7fee' }, btnColor: { type: String, default: '#ff5a6e' }, uploadOption: { type: Object, default () { return {} } }, appId: { type: String, default: '' }, hideLabel: { type: Boolean, default: false } }, computed: { common () { return { visible: this.visible, tit: this.tit, subTit: this.subTit, tips: this.tips, remarks: this.remarks, errMsg: this.errMsg, colons: this.colons, align: this.align, border: this.border, titPadding: this.titPadding, hideLabel: this.hideLabel } }, size () { return formatFontSize(this.fontSize) } }, methods: { showTips () { if (this.tips) { let tips = this.tips if (isString(tips)) { try { tips = JSON.parse(tips) if (!isObject(tips)) { tips = { title: this.tit, text: this.tips } } } catch (e) { tips = { title: this.tit, text: this.tips } } } this.$emit(EVENT_TIPS_CLICK, tips) } } } }