papayaui 0.2.2 → 0.2.4

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/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  - 💪 Vue 3 Composition API
6
6
  - 🔥 Written in TypeScript
7
+ - 🧀 [Document](https://jiangwei58.github.io/papayaui)
7
8
 
8
9
  ## 准备工作
9
10
 
@@ -83,8 +84,6 @@ pnpm install async-validator dayjs
83
84
  // ...
84
85
  "types": ["papayaui/global"]
85
86
  },
86
- // 防止组件props类型识别错误
87
- "include": ["node_modules/papayaui/components/*/*.vue"]
88
87
  }
89
88
  ```
90
89
 
@@ -24,6 +24,13 @@
24
24
  margin-right: _var(cell-icon-left-margin-left, 4px);
25
25
  }
26
26
 
27
+ &__label {
28
+ margin-top: 4px;
29
+ color: _var(cell-label-color, _var(color-black-3));
30
+ font-size: _var(cell-label-font-size, 12px);
31
+ line-height: _var(cell-label-line-height, 18px);
32
+ }
33
+
27
34
  &__value {
28
35
  position: relative;
29
36
  overflow: hidden;
@@ -17,7 +17,10 @@
17
17
  :style="{ flex: titleWidth ? `0 ${getUnitValue(titleWidth)}` : '1' }"
18
18
  >
19
19
  <slot v-if="$slots.title" name="title" />
20
- <text v-else>{{ title }}</text>
20
+ <template v-else>
21
+ <text>{{ title }}</text>
22
+ <view v-if="label" :class="ns.e('label')">{{ label }}</view>
23
+ </template>
21
24
  </view>
22
25
  <view :class="[ns.e('value'), valueClass]">
23
26
  <slot v-if="$slots.default" />
@@ -14,6 +14,10 @@ export const cellProps = {
14
14
  type: [String, Number, Boolean],
15
15
  default: '',
16
16
  },
17
+ /**
18
+ * 标题下方的描述信息
19
+ */
20
+ label: String,
17
21
  /**
18
22
  * 标题宽度
19
23
  */
@@ -3,14 +3,16 @@
3
3
  &-button {
4
4
  font-size: _var(checkbox-btns-font-size, 14px);
5
5
  color: _var(checkbox-btns-color, _var(color-black));
6
+ background-color: _var(checkbox-btns-background, _var(color-gray));
7
+ border-color: _var(checkbox-btns-border-color, _var(color-gray));
6
8
  padding: _var(checkbox-btns-padding, 7px 4px);
7
9
  border-width: _var(checkbox-btns-border-width, 2rpx);
8
10
  border-style: solid;
9
11
  text-align: center;
10
12
  &.active {
11
- color: _var(color-primary);
12
- background-color: rgba(0, 156, 93, 0.1) !important;
13
- border-color: _var(color-primary) !important;
13
+ color: _var(checkbox-btns-active-color, _var(color-primary));
14
+ background-color: _var(checkbox-btns-active-background, rgba(0, 156, 93, 0.1)) !important;
15
+ border-color: _var(checkbox-btns-active-border-color, _var(color-primary)) !important;
14
16
  }
15
17
  }
16
18
  }
@@ -13,11 +13,13 @@
13
13
  active: typeof modelValue !== 'undefined' ? isSelected(item[valueKey]) : false,
14
14
  },
15
15
  ]"
16
- :style="{
17
- backgroundColor: bgColor,
18
- borderColor: bgColor,
19
- borderRadius: getUnitValue(typeof round === 'boolean' ? (round ? '100' : '0') : round),
20
- }"
16
+ :style="
17
+ ns.style({
18
+ backgroundColor: bgColor,
19
+ borderColor: bgColor,
20
+ borderRadius: getUnitValue(typeof round === 'boolean' ? (round ? '100' : '0') : round),
21
+ })
22
+ "
21
23
  @tap="onSelect(item, index)"
22
24
  >
23
25
  <slot v-if="$slots.default" :item="item" :index="index" />
@@ -56,10 +56,7 @@ export const checkboxButtonsProps = {
56
56
  /**
57
57
  * 背景色
58
58
  */
59
- bgColor: {
60
- type: String,
61
- default: '#F2F3F5',
62
- },
59
+ bgColor: String,
63
60
  /**
64
61
  * 圆角大小, 值为true时半圆角
65
62
  */
@@ -0,0 +1,19 @@
1
+ @import '../../styles/vars.scss';
2
+
3
+ .#{$prefix}-circle {
4
+ position: relative;
5
+ display: inline-block;
6
+ text-align: center;
7
+
8
+ &__text {
9
+ position: absolute;
10
+ top: 50%;
11
+ left: 0;
12
+ width: 100%;
13
+ color: _var(circle-text-color, _var(color-black));
14
+ font-weight: _var(circle-font-weight, 500);
15
+ font-size: _var(circle-font-size, 14px);
16
+ line-height: _var(circle-text-line-height, 20px);
17
+ transform: translateY(-50%);
18
+ }
19
+ }
@@ -0,0 +1,163 @@
1
+ <template>
2
+ <view :class="ns.b()">
3
+ <canvas
4
+ :id="id"
5
+ :canvas-id="id"
6
+ type="2d"
7
+ :style="{
8
+ width: getUnitValue(size, 'px'),
9
+ height: getUnitValue(size, 'px'),
10
+ }"
11
+ />
12
+ <view v-if="!text" :class="ns.e('text')">
13
+ <slot></slot>
14
+ </view>
15
+ <cover-view v-else :class="ns.e('text')">{{ text }}</cover-view>
16
+ </view>
17
+ </template>
18
+
19
+ <script setup lang="ts">
20
+ import { getCurrentInstance, onMounted, watch } from 'vue'
21
+ import { useNamespace } from '../../core'
22
+ import { getUnitValue } from '../../utils'
23
+ import { circleProps } from './props'
24
+
25
+ const ns = useNamespace('circle')
26
+
27
+ const props = defineProps(circleProps)
28
+
29
+ const instance = getCurrentInstance()
30
+ const id = ns.e('canvas') + Date.now()
31
+
32
+ const BEGIN_ANGLE = -Math.PI / 2
33
+ const PERIMETER = 2 * Math.PI
34
+ const STEP = 1
35
+
36
+ let context: CanvasRenderingContext2D | null = null
37
+ let currentValue = 0
38
+
39
+ onMounted(() => {
40
+ // #ifdef H5
41
+ initH5()
42
+ // #endif
43
+ // #ifndef H5
44
+ initMP()
45
+ // #endif
46
+ })
47
+
48
+ watch(
49
+ () => props.modelValue,
50
+ () => {
51
+ if (context) {
52
+ renderCircle(context)
53
+ }
54
+ },
55
+ )
56
+
57
+ const initMP = () => {
58
+ const ratio = uni.getSystemInfoSync().pixelRatio
59
+ const query = uni.createSelectorQuery()
60
+ query
61
+ .in(instance)
62
+ .select('#' + id)
63
+ .node(() => {})
64
+ .exec((res) => {
65
+ const canvas = res[0].node as HTMLCanvasElement
66
+ const canvasSize = props.size * ratio
67
+ canvas.width = canvasSize
68
+ canvas.height = canvasSize
69
+ context = canvas.getContext('2d')
70
+ if (!context) return
71
+
72
+ context.scale(ratio, ratio)
73
+ renderCircle(context)
74
+ })
75
+ }
76
+
77
+ const initH5 = () => {
78
+ const ratio = window.devicePixelRatio
79
+ const canvasSize = props.size * ratio
80
+ const canvas = document.querySelector(`#${id} canvas`) as HTMLCanvasElement
81
+ canvas.width = canvasSize
82
+ canvas.height = canvasSize
83
+ context = canvas.getContext('2d')
84
+ if (!context) return
85
+
86
+ context.scale(ratio, ratio)
87
+ renderCircle(context)
88
+ }
89
+
90
+ const renderCircle = (ctx: CanvasRenderingContext2D) => {
91
+ if (props.speed <= 0 || props.speed > 1000) {
92
+ drawCircle(ctx, props.modelValue)
93
+ return
94
+ }
95
+
96
+ let interval: number | null
97
+ currentValue = currentValue ?? 0
98
+ const run = () => {
99
+ interval = setTimeout(() => {
100
+ if (currentValue === props.modelValue) {
101
+ stop()
102
+ return
103
+ }
104
+ if (Math.abs(currentValue - props.modelValue) < STEP) {
105
+ currentValue = props.modelValue
106
+ } else if (currentValue < props.modelValue) {
107
+ currentValue += STEP
108
+ } else {
109
+ currentValue -= STEP
110
+ }
111
+ drawCircle(ctx, currentValue)
112
+ run()
113
+ }, 1000 / props.speed) as unknown as number | null
114
+ }
115
+
116
+ const stop = () => {
117
+ if (interval) {
118
+ clearTimeout(interval)
119
+ interval = null
120
+ }
121
+ }
122
+
123
+ stop()
124
+ run()
125
+ }
126
+
127
+ const drawLayerCircle = (ctx: CanvasRenderingContext2D) => {
128
+ drawCanvas(ctx, BEGIN_ANGLE, PERIMETER, props.layerColor)
129
+ }
130
+
131
+ const drawCircle = (ctx: CanvasRenderingContext2D, value: number) => {
132
+ const progress = PERIMETER * (value / 100)
133
+ const endAngle = props.clockwise ? BEGIN_ANGLE + progress : 3 * Math.PI - (BEGIN_ANGLE + progress)
134
+ ctx.clearRect(0, 0, props.size, props.size)
135
+ drawLayerCircle(ctx)
136
+ if (value !== 0) {
137
+ drawCanvas(ctx, BEGIN_ANGLE, endAngle, props.color, props.clockwise)
138
+ }
139
+ }
140
+
141
+ const drawCanvas = (
142
+ ctx: CanvasRenderingContext2D,
143
+ sRadian: number,
144
+ eRadian: number,
145
+ color: string,
146
+ clockwise = true,
147
+ ) => {
148
+ const position = props.size / 2
149
+ const lineWidth = Number(props.strokeWidth)
150
+ const radius = position - lineWidth / 2
151
+
152
+ ctx.beginPath()
153
+ ctx.lineCap = 'round'
154
+ ctx.strokeStyle = color
155
+ ctx.lineWidth = lineWidth
156
+ ctx.arc(position, position, radius, sRadian, eRadian, !clockwise)
157
+ ctx.stroke()
158
+ }
159
+ </script>
160
+
161
+ <style lang="scss" scoped>
162
+ @import './circle.scss';
163
+ </style>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <DocDemoBlock title="基础用法" card>
3
+ <Demo1 />
4
+ </DocDemoBlock>
5
+ <DocDemoBlock title="样式定制" card>
6
+ <Demo2 />
7
+ </DocDemoBlock>
8
+ </template>
9
+
10
+ <script setup lang="ts">
11
+ import DocDemoBlock from '../../doc/doc-demo-block.vue'
12
+ import Demo1 from '../../demos/circle/demo-1.vue'
13
+ import Demo2 from '../../demos/circle/demo-2.vue'
14
+ </script>
15
+
16
+ <style lang="scss" scoped></style>
17
+ <style lang="scss">
18
+ page {
19
+ background-color: var(--pa-color-gray);
20
+ }
21
+ </style>
@@ -0,0 +1,4 @@
1
+ import type Circle from './circle.vue'
2
+
3
+ export type CircleInstance = InstanceType<typeof Circle>
4
+ export * from './props'
@@ -0,0 +1,59 @@
1
+ import type { ExtractPropTypes } from 'vue'
2
+
3
+ export const circleProps = {
4
+ /**
5
+ * 目标进度
6
+ */
7
+ modelValue: {
8
+ type: Number,
9
+ default: 0,
10
+ },
11
+ /**
12
+ * 圆环直径,单位px
13
+ */
14
+ size: {
15
+ type: Number,
16
+ default: 100,
17
+ },
18
+ /**
19
+ * 进度条颜色
20
+ */
21
+ color: {
22
+ type: String,
23
+ default: '#009c5d',
24
+ },
25
+ /**
26
+ * 轨道颜色
27
+ */
28
+ layerColor: {
29
+ type: String,
30
+ default: '#fff',
31
+ },
32
+ /**
33
+ * 文字
34
+ */
35
+ text: String,
36
+ /**
37
+ * 进度条宽度,单位px
38
+ */
39
+ strokeWidth: {
40
+ type: [Number, String],
41
+ default: 4,
42
+ },
43
+ /**
44
+ * 是否顺时针
45
+ */
46
+ clockwise: {
47
+ type: Boolean,
48
+ default: true,
49
+ },
50
+ /**
51
+ * 动画速度(单位为 value/s)
52
+ */
53
+ speed: {
54
+ type: Number,
55
+ default: 50,
56
+ },
57
+ }
58
+
59
+ export type CircleProps = ExtractPropTypes<typeof circleProps>
@@ -112,7 +112,7 @@ export const fieldProps = {
112
112
  export const fieldEmits = {
113
113
  'update:modelValue': (value: string) => isString(value),
114
114
  input: (value: string) => isString(value),
115
- blur: (value: FocusEvent) => isObject(value),
115
+ blur: (value: unknown) => isObject(value),
116
116
  confirm: (value: EventDetail<{ value: string }>) => isObject(value),
117
117
  clear: () => true,
118
118
  'click-input': (value: Event) => isObject(value),
@@ -4,9 +4,17 @@
4
4
  :title="label"
5
5
  :error-message="errorMessage"
6
6
  v-bind="$props"
7
+ :label="desc"
7
8
  @click="emit('click')"
8
9
  />
9
- <Cell v-else :title="label" :error-message="errorMessage" v-bind="$props" @click="emit('click')">
10
+ <Cell
11
+ v-else
12
+ :title="label"
13
+ :error-message="errorMessage"
14
+ v-bind="$props"
15
+ :label="desc"
16
+ @click="emit('click')"
17
+ >
10
18
  <slot />
11
19
  </Cell>
12
20
  </template>
@@ -4,7 +4,7 @@ import { pick } from '../../utils'
4
4
  import { cellProps } from '../cell'
5
5
 
6
6
  export const formItemProps = {
7
- ...pick(cellProps, ['suffix']),
7
+ ...pick(cellProps, ['titleWidth', 'suffix']),
8
8
  /**
9
9
  * 校验对应的字段名
10
10
  */
@@ -13,6 +13,10 @@ export const formItemProps = {
13
13
  * 标签名
14
14
  */
15
15
  label: String,
16
+ /**
17
+ * 描述信息
18
+ */
19
+ desc: String,
16
20
  /**
17
21
  * 校验规则
18
22
  */
@@ -8,6 +8,7 @@ export * from './cell-group'
8
8
  export * from './checkbox'
9
9
  export * from './checkbox-btns'
10
10
  export * from './checkbox-group'
11
+ export * from './circle'
11
12
  export * from './collapse'
12
13
  export * from './collapse-item'
13
14
  export * from './container'
@@ -1,15 +1,15 @@
1
1
  @import '../../styles/vars.scss';
2
2
 
3
3
  .#{$prefix}-menu {
4
- $barHeight: 48px;
4
+ $barHeight: _var(menu-height, 48px);
5
5
 
6
6
  position: relative;
7
7
  &__bar {
8
8
  position: relative;
9
9
  display: flex;
10
10
  height: $barHeight;
11
- background-color: #fff;
12
- box-shadow: 0 2px 12px rgb(100 101 102 / 12%);
11
+ background-color: _var(menu-background, #fff);
12
+ box-shadow: _var(menu-shadow, 0 2px 12px rgb(100 101 102 / 12%));
13
13
  }
14
14
 
15
15
  &__item {
@@ -25,10 +25,10 @@
25
25
  position: relative;
26
26
  box-sizing: border-box;
27
27
  max-width: 100%;
28
- padding: 0 8px;
29
- color: _var(color-black);
30
- font-size: 15px;
31
- line-height: 22px;
28
+ padding: _var(menu-title-padding, 0 8px);
29
+ color: _var(menu-title-color, _var(color-black));
30
+ font-size: _var(menu-title-font-size, 15px);
31
+ line-height: _var(menu-title-line-height, 22px);
32
32
 
33
33
  &::after {
34
34
  position: absolute;
@@ -60,4 +60,4 @@
60
60
  border-color: transparent transparent currentColor currentColor;
61
61
  }
62
62
  }
63
- }
63
+ }
@@ -14,6 +14,7 @@
14
14
  :key="item.value"
15
15
  :class="ns.is('active', isSelected(item.value))"
16
16
  :title="item.text"
17
+ :value="item.valueText"
17
18
  clickable
18
19
  @click="onChange(item)"
19
20
  >
@@ -43,6 +43,8 @@ export interface MenuItemOption {
43
43
  text: string
44
44
  /** 标识符 */
45
45
  value: MenuItemOptionValue
46
+ /** 右侧文字 */
47
+ valueText?: string
46
48
  }
47
49
 
48
50
  export type MenuItemOptionValue = number | string
@@ -51,6 +51,7 @@ export const searchEmits = {
51
51
  'update:modelValue': (value: string) => isString(value),
52
52
  change: (value: string) => isString(value),
53
53
  confirm: (value: EventDetail<{ value: string }>) => isObject(value),
54
+ blur: (value: unknown) => isObject(value),
54
55
  clear: () => true,
55
56
  'click-input': () => true,
56
57
  }
@@ -1,18 +1,23 @@
1
1
  @import '../../styles/vars.scss';
2
2
  .#{$prefix}-search {
3
- @include _setVar(field-input-color, _var(color-black));
4
- @include _setVar(cell-bg-color, transparent);
5
- @include _setVar(cell-title-color, _var(color-black-3));
6
- @include _setVar(cell-padding-x, 8px);
7
- @include _setVar(cell-padding-y, 8px);
8
3
  padding: _var(search-padding, 10px 12px);
9
4
  background-color: _var(search-bg-color, #fff);
10
- &-input {
5
+
6
+ &__content {
11
7
  flex: 1;
12
8
  background-color: _var(search-input-bg-color, _var(color-gray));
13
- border-radius: 3px;
9
+ border-radius: _var(search-input-radius, 3px);
14
10
  }
15
- &--round &-input {
11
+
12
+ &__input {
13
+ @include _setVar(field-input-color, _var(search-input-color, _var(color-black)));
14
+ @include _setVar(cell-bg-color, transparent);
15
+ @include _setVar(cell-title-color, _var(search-icon-color, _var(color-black-3)));
16
+ @include _setVar(cell-padding-x, _var(search-input-padding-x, 8px));
17
+ @include _setVar(cell-padding-y, _var(search-input-padding-y, 5px));
18
+ }
19
+
20
+ &--round &__content {
16
21
  border-radius: 100px;
17
22
  }
18
23
  }
@@ -6,12 +6,13 @@
6
6
  >
7
7
  <slot name="before" />
8
8
  <view
9
- :class="ns.b('input')"
9
+ :class="ns.e('content')"
10
10
  class="flex items-center"
11
11
  :style="ns.style({ backgroundColor: inputBackground })"
12
12
  >
13
13
  <slot name="prefix" />
14
14
  <Field
15
+ :class="ns.e('input')"
15
16
  class="flex-1"
16
17
  :model-value="modelValue"
17
18
  icon="search"
@@ -23,6 +24,7 @@
23
24
  :clearable="clearable"
24
25
  @update:model-value="onUpdate"
25
26
  @confirm="emit('confirm', $event)"
27
+ @blur="emit('blur', $event)"
26
28
  @clear="emit('clear')"
27
29
  @click-input="emit('click-input')"
28
30
  />
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <pa-circle :model-value="80" />
3
+ </template>
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <view>
3
+ <pa-circle :model-value="progress" stroke-width="8" text="设置宽度" />
4
+ <pa-circle :model-value="progress" color="#ff2b2b" text="设置颜色" />
5
+ <pa-circle :model-value="progress" :clockwise="false" text="逆时针" />
6
+ <pa-circle :model-value="progress" :size="150" text="设置大小" />
7
+ </view>
8
+ <view class="mt-15">
9
+ <pa-button type="primary" @click="add">增加</pa-button>
10
+ <pa-button type="danger" class="ml-15" @click="subtract">减少</pa-button>
11
+ </view>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import { ref } from 'vue'
16
+
17
+ const STEP = 10
18
+ const progress = ref(80)
19
+
20
+ const add = () => {
21
+ if (progress.value >= 100) return
22
+ progress.value += STEP
23
+ }
24
+
25
+ const subtract = () => {
26
+ if (progress.value <= 0) return
27
+ progress.value -= STEP
28
+ }
29
+ </script>
30
+
31
+ <style lang="scss" scoped>
32
+ :deep(.pa-circle) {
33
+ margin-right: 15px;
34
+ }
35
+ </style>
Binary file
package/global.d.ts CHANGED
@@ -10,6 +10,7 @@ declare module '@vue/runtime-core' {
10
10
  PaCheckbox: typeof import('papayaui/components/checkbox/checkbox.vue')['default']
11
11
  PaCheckboxBtns: typeof import('papayaui/components/checkbox-btns/checkbox-btns.vue')['default']
12
12
  PaCheckboxGroup: typeof import('papayaui/components/checkbox-group/checkbox-group.vue')['default']
13
+ PaCircle: typeof import('papayaui/components/circle/circle.vue')['default']
13
14
  PaCollapse: typeof import('papayaui/components/collapse/collapse.vue')['default']
14
15
  PaCollapseItem: typeof import('papayaui/components/collapse-item/collapse-item.vue')['default']
15
16
  PaContainer: typeof import('papayaui/components/container/container.vue')['default']
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "papayaui",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "适用于uniapp的ui扩展库",
5
5
  "packageManager": "pnpm@8.6.0",
6
6
  "dependencies": {
@@ -18,7 +18,7 @@
18
18
  "bugs": {
19
19
  "url": "https://github.com/jiangwei58/papayaui/issues"
20
20
  },
21
- "homepage": "https://github.com/jiangwei58/papayaui",
21
+ "homepage": "https://jiangwei58.github.io/papayaui",
22
22
  "author": "jiangw",
23
23
  "license": "MIT",
24
24
  "main": "index.ts",
@@ -60,9 +60,15 @@
60
60
  // 定义圆角
61
61
  @for $i from 3 through 35 {
62
62
  .rounded-#{$i} {
63
- border-radius: #{$i}rpx;
63
+ border-radius: $i + $pixelUnit;
64
64
  }
65
65
  }
66
+ .rounded-none {
67
+ border-radius: 0;
68
+ }
69
+ .rounded-full {
70
+ border-radius: 9999px;
71
+ }
66
72
 
67
73
  // 盒子模型
68
74
  .box-border {
@@ -1,14 +1,14 @@
1
- // 定义字体(rpx单位)
1
+ // 定义字体大小
2
2
  @for $i from 20 through 65 {
3
3
  .text-#{$i} {
4
- font-size: #{$i}rpx;
4
+ font-size: $i + $pixelUnit;
5
5
  }
6
6
  }
7
7
 
8
8
  // 定义字体行高
9
9
  @for $i from 10 through 65 {
10
10
  .leading-#{$i} {
11
- line-height: #{$i}rpx;
11
+ line-height: $i + $pixelUnit;
12
12
  }
13
13
  }
14
14
 
@@ -62,13 +62,13 @@
62
62
  // 只要双数和能被5除尽的数
63
63
  @if $i % 2 == 0 or $i % 5 == 0 {
64
64
  .gap-#{$i} {
65
- gap: $i + rpx;
65
+ gap: $i + $pixelUnit;
66
66
  }
67
67
  .gap-x-#{$i} {
68
- column-gap: $i + rpx;
68
+ column-gap: $i + $pixelUnit;
69
69
  }
70
70
  .gap-y-#{$i} {
71
- row-gap: $i + rpx;
71
+ row-gap: $i + $pixelUnit;
72
72
  }
73
73
  }
74
74
  }
@@ -3,37 +3,37 @@
3
3
  // 只要双数和能被5除尽的数
4
4
  @if $i % 2 == 0 or $i % 5 == 0 {
5
5
  .m-#{$i} {
6
- margin: $i + rpx !important;
6
+ margin: $i + $pixelUnit !important;
7
7
  }
8
8
 
9
9
  .p-#{$i} {
10
- padding: $i + rpx !important;
10
+ padding: $i + $pixelUnit !important;
11
11
  }
12
12
 
13
13
  .mx-#{$i} {
14
- margin-left: $i + rpx;
15
- margin-right: $i + rpx;
14
+ margin-left: $i + $pixelUnit;
15
+ margin-right: $i + $pixelUnit;
16
16
  }
17
17
  .my-#{$i} {
18
- margin-top: $i + rpx;
19
- margin-bottom: $i + rpx;
18
+ margin-top: $i + $pixelUnit;
19
+ margin-bottom: $i + $pixelUnit;
20
20
  }
21
21
  .px-#{$i} {
22
- padding-left: $i + rpx;
23
- padding-right: $i + rpx;
22
+ padding-left: $i + $pixelUnit;
23
+ padding-right: $i + $pixelUnit;
24
24
  }
25
25
  .py-#{$i} {
26
- padding-top: $i + rpx;
27
- padding-bottom: $i + rpx;
26
+ padding-top: $i + $pixelUnit;
27
+ padding-bottom: $i + $pixelUnit;
28
28
  }
29
29
 
30
30
  @each $short, $long in l left, t top, r right, b bottom {
31
31
  .m#{$short}-#{$i} {
32
- margin-#{$long}: $i + rpx !important;
32
+ margin-#{$long}: $i + $pixelUnit !important;
33
33
  }
34
34
 
35
35
  .p#{$short}-#{$i} {
36
- padding-#{$long}: $i + rpx !important;
36
+ padding-#{$long}: $i + $pixelUnit !important;
37
37
  }
38
38
  }
39
39
  }
package/styles/vars.scss CHANGED
@@ -1,4 +1,5 @@
1
- $prefix: pa;
1
+ $prefix: pa !default;
2
+ $pixelUnit: rpx !default;
2
3
 
3
4
  @function _var($varName, $default: null) {
4
5
  @if ($default == null) {