123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- export default {
- props: {
-
- flexDirection: {
- type: String,
- default: ''
- },
-
- fd: {
- type: String,
- default: ''
- },
-
- display: {
- type: String,
- default: ''
- },
-
- d: {
- type: String,
- default: ''
- },
-
- justifyContent: {
- type: String,
- default: ''
- },
-
- jc: {
- type: String,
- default: ''
- },
-
- alignItems: {
- type: String,
- default: ''
- },
-
- ai: {
- type: String,
- default: ''
- },
- color: {
- type: String,
- default: ''
- },
-
- c: {
- type: String,
- default: ''
- },
-
- fontSize: {
- type: [String, Number],
- default: 0
- },
-
- fs: {
- type: [String, Number],
- default: ''
- },
- margin: {
- type: [String, Number],
- default: 0
- },
-
- m: {
- type: [String, Number],
- default: 0
- },
-
- marginTop: {
- type: [String, Number],
- default: 0
- },
-
- mt: {
- type: [String, Number],
- default: 0
- },
-
- marginRight: {
- type: [String, Number],
- default: 0
- },
-
- mr: {
- type: [String, Number],
- default: 0
- },
-
- marginBottom: {
- type: [String, Number],
- default: 0
- },
-
- mb: {
- type: [String, Number],
- default: 0
- },
-
- marginLeft: {
- type: [String, Number],
- default: 0
- },
-
- ml: {
- type: [String, Number],
- default: 0
- },
-
- paddingLeft: {
- type: [String, Number],
- default: 0
- },
-
- pl: {
- type: [String, Number],
- default: 0
- },
-
- paddingTop: {
- type: [String, Number],
- default: 0
- },
-
- pt: {
- type: [String, Number],
- default: 0
- },
-
- paddingRight: {
- type: [String, Number],
- default: 0
- },
-
- pr: {
- type: [String, Number],
- default: 0
- },
-
- paddingBottom: {
- type: [String, Number],
- default: 0
- },
-
- pb: {
- type: [String, Number],
- default: 0
- },
-
- borderRadius: {
- type: [String, Number],
- default: 0
- },
-
- radius: {
- type: [String, Number],
- default: 0
- },
-
- transform: {
- type: String,
- default: ''
- },
-
- position: {
- type: String,
- default: ''
- },
-
- pos: {
- type: String,
- default: ''
- },
-
- width: {
- type: [String, Number],
- default: null
- },
-
- w: {
- type: [String, Number],
- default: null
- },
-
- height: {
- type: [String, Number],
- default: null
- },
-
- h: {
- type: [String, Number],
- default: null
- },
- top: {
- type: [String, Number],
- default: 0
- },
- right: {
- type: [String, Number],
- default: 0
- },
- bottom: {
- type: [String, Number],
- default: 0
- },
- left: {
- type: [String, Number],
- default: 0
- }
- },
- computed: {
- viewStyle() {
- const style = {}
- const addStyle = uni.$u.addStyle(this.width || this.w) && (style.width = addStyle(this.width || this.w))(this.height || this.h) && (style.height = addStyle(this.height || this.h))(this.margin || this.m) && (style.margin = addStyle(this.margin || this.m))(this.marginTop || this.mt) && (style.marginTop = addStyle(this.marginTop || this.mt))(this.marginRight || this.mr) && (style.marginRight = addStyle(this.marginRight || this.mr))(this.marginBottom || this.mb) && (style.marginBottom = addStyle(this.marginBottom || this.mb))(this.marginLeft || this.ml) && (style.marginLeft = addStyle(this.marginLeft || this.ml))(this.padding || this.p) && (style.padding = addStyle(this.padding || this.p))(this.paddingTop || this.pt) && (style.paddingTop = addStyle(this.paddingTop || this.pt))(this.paddingRight || this.pr) && (style.paddingRight = addStyle(this.paddingRight || this.pr))(this.paddingBottom || this.pb) && (style.paddingBottom = addStyle(this.paddingBottom || this.pb))(this.paddingLeft || this.pl) && (style.paddingLeft = addStyle(this.paddingLeft || this.pl))(this.color || this.c) && (style.color = this.color || this.c)(this.fontSize || this.fs) && (style.fontSize = this.fontSize || this.fs)(this.borderRadius || this.radius) && (style.borderRadius = this.borderRadius || this.radius)(this.position || this.pos) && (this.position = this.position || this.pos)(this.flexDirection || this.fd) && (this.flexDirection = this.flexDirection || this.fd)(this.justifyContent || jc) && (this.justifyContent = this.justifyContent || jc)(this.alignItems || ai) && (this.alignItems = this.alignItems || ai)
- return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
- }
- },
- methods: {
-
- getUnit(unit = '') {
-
- return uni.$u.trim(unit).split(' ').map((item) => uni.$u.addUnit(item)).join(' ')
- }
- }
- }
|