From bd99a5211f3a5fcaa051e5da868d87bb870148f5 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Fri, 01 Mar 2024 09:58:45 +0800
Subject: [PATCH] fix:手持设备
---
uni_modules/uview-ui/libs/mixin/style.js | 228 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 228 insertions(+), 0 deletions(-)
diff --git a/uni_modules/uview-ui/libs/mixin/style.js b/uni_modules/uview-ui/libs/mixin/style.js
new file mode 100644
index 0000000..2660180
--- /dev/null
+++ b/uni_modules/uview-ui/libs/mixin/style.js
@@ -0,0 +1,228 @@
+export default {
+ props: {
+ // flex������������
+ flexDirection: {
+ type: String,
+ default: ''
+ },
+ // flex-direction���������
+ fd: {
+ type: String,
+ default: ''
+ },
+ // ������������
+ display: {
+ type: String,
+ default: ''
+ },
+ // display������
+ d: {
+ type: String,
+ default: ''
+ },
+ // ������������������
+ justifyContent: {
+ type: String,
+ default: ''
+ },
+ // justifyContent���������
+ jc: {
+ type: String,
+ default: ''
+ },
+ // ������������������
+ alignItems: {
+ type: String,
+ default: ''
+ },
+ // align-items���������
+ ai: {
+ type: String,
+ default: ''
+ },
+ color: {
+ type: String,
+ default: ''
+ },
+ // color������
+ c: {
+ type: String,
+ default: ''
+ },
+ // ������������
+ fontSize: {
+ type: [String, Number],
+ default: 0
+ },
+ // font-size������
+ fs: {
+ type: [String, Number],
+ default: ''
+ },
+ margin: {
+ type: [String, Number],
+ default: 0
+ },
+ // margin������
+ m: {
+ type: [String, Number],
+ default: 0
+ },
+ // margin-top
+ marginTop: {
+ type: [String, Number],
+ default: 0
+ },
+ // margin-top������
+ mt: {
+ type: [String, Number],
+ default: 0
+ },
+ // margin-right
+ marginRight: {
+ type: [String, Number],
+ default: 0
+ },
+ // margin-right������
+ mr: {
+ type: [String, Number],
+ default: 0
+ },
+ // margin-bottom
+ marginBottom: {
+ type: [String, Number],
+ default: 0
+ },
+ // margin-bottom������
+ mb: {
+ type: [String, Number],
+ default: 0
+ },
+ // margin-left
+ marginLeft: {
+ type: [String, Number],
+ default: 0
+ },
+ // margin-left������
+ ml: {
+ type: [String, Number],
+ default: 0
+ },
+ // padding-left
+ paddingLeft: {
+ type: [String, Number],
+ default: 0
+ },
+ // padding-left������
+ pl: {
+ type: [String, Number],
+ default: 0
+ },
+ // padding-top
+ paddingTop: {
+ type: [String, Number],
+ default: 0
+ },
+ // padding-top������
+ pt: {
+ type: [String, Number],
+ default: 0
+ },
+ // padding-right
+ paddingRight: {
+ type: [String, Number],
+ default: 0
+ },
+ // padding-right������
+ pr: {
+ type: [String, Number],
+ default: 0
+ },
+ // padding-bottom
+ paddingBottom: {
+ type: [String, Number],
+ default: 0
+ },
+ // padding-bottom������
+ pb: {
+ type: [String, Number],
+ default: 0
+ },
+ // border-radius
+ borderRadius: {
+ type: [String, Number],
+ default: 0
+ },
+ // border-radius������
+ radius: {
+ type: [String, Number],
+ default: 0
+ },
+ // transform
+ transform: {
+ type: String,
+ default: ''
+ },
+ // ������
+ position: {
+ type: String,
+ default: ''
+ },
+ // position������
+ pos: {
+ type: String,
+ default: ''
+ },
+ // ������
+ width: {
+ type: [String, Number],
+ default: null
+ },
+ // width������
+ w: {
+ type: [String, Number],
+ default: null
+ },
+ // ������
+ height: {
+ type: [String, Number],
+ default: null
+ },
+ // height������
+ 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: {
+ // ������margin������padding������������������padding: 0 20������padding: 0 20px
+ getUnit(unit = '') {
+ // ������������������������������������������������������������������������������������������������������������
+ return uni.$u.trim(unit).split(' ').map((item) => uni.$u.addUnit(item)).join(' ')
+ }
+ }
+}
--
Gitblit v1.8.0