@vtj/materials 0.10.1-alpha.5 → 0.10.1-alpha.7
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/dist/assets/antdv/index.umd.js +2 -2
- package/dist/assets/charts/index.umd.js +2 -2
- package/dist/assets/element/index.umd.js +2 -2
- package/dist/assets/ui/index.umd.js +2 -2
- package/dist/assets/uni-h5/index.umd.js +2 -2
- package/dist/assets/uni-ui/index.umd.js +3 -3
- package/dist/assets/vant/index.umd.js +2 -2
- package/dist/deps/@vtj/charts/index.umd.js +2 -2
- package/dist/deps/@vtj/icons/index.umd.js +2 -2
- package/dist/deps/@vtj/ui/index.umd.js +2 -2
- package/dist/deps/@vtj/utils/index.umd.js +2 -2
- package/dist/deps/uni-h5/style.css +1 -1
- package/dist/deps/uni-ui/index.umd.js +1 -1
- package/dist/deps/uni-ui/style.css +1 -1
- package/package.json +5 -5
- package/src/uni-h5/style.scss +0 -1
- package/src/uni-ui/components/badge.ts +5 -1
- package/src/uni-ui/components/breadcrumb.ts +76 -0
- package/src/uni-ui/components/calendar.ts +63 -0
- package/src/uni-ui/components/card.ts +113 -0
- package/src/uni-ui/components/collapse.ts +118 -0
- package/src/uni-ui/components/combox.ts +51 -0
- package/src/uni-ui/components/countdown.ts +92 -0
- package/src/uni-ui/components/dataCheckbox.ts +104 -0
- package/src/uni-ui/components/dataPicker.ts +146 -0
- package/src/uni-ui/components/dataSelect.ts +68 -0
- package/src/uni-ui/components/dateformat.ts +42 -0
- package/src/uni-ui/components/datetimePicker.ts +103 -0
- package/src/uni-ui/components/drawer.ts +38 -0
- package/src/uni-ui/components/easyinput.ts +159 -0
- package/src/uni-ui/components/fab.ts +89 -0
- package/src/uni-ui/components/fav.ts +65 -0
- package/src/uni-ui/components/filePicker.ts +127 -0
- package/src/uni-ui/components/forms.ts +209 -0
- package/src/uni-ui/components/goodsNav.ts +31 -0
- package/src/uni-ui/components/grid.ts +104 -0
- package/src/uni-ui/components/group.ts +50 -0
- package/src/uni-ui/components/icons.ts +47 -0
- package/src/uni-ui/components/index.ts +89 -1
- package/src/uni-ui/components/indexedList.ts +51 -0
- package/src/uni-ui/components/link.ts +60 -0
- package/src/uni-ui/components/list.ts +259 -0
- package/src/uni-ui/components/loadMore.ts +61 -0
- package/src/uni-ui/components/navbar.ts +121 -0
- package/src/uni-ui/components/noticeBar.ts +83 -0
- package/src/uni-ui/components/numberbox.ts +49 -0
- package/src/uni-ui/components/pagination.ts +59 -0
- package/src/uni-ui/components/popup.ts +206 -0
- package/src/uni-ui/components/rate.ts +89 -0
- package/src/uni-ui/components/row.ts +126 -0
- package/src/uni-ui/components/searchBar.ts +84 -0
- package/src/uni-ui/components/section.ts +68 -0
- package/src/uni-ui/components/segmentedControl.ts +48 -0
- package/src/uni-ui/components/steps.ts +55 -0
- package/src/uni-ui/components/swipeAction.ts +133 -0
- package/src/uni-ui/components/swiperDot.ts +114 -0
- package/src/uni-ui/components/table.ts +132 -0
- package/src/uni-ui/components/tag.ts +56 -0
- package/src/uni-ui/components/title.ts +49 -0
- package/src/uni-ui/components/tooltip.ts +32 -0
- package/src/uni-ui/components/transition.ts +49 -0
- package/src/uni-ui/index.ts +30 -13
- package/src/uni-ui/lib/uni-col/uni-col.vue +324 -0
- package/src/uni-ui/lib/uni-data-select/uni-data-select.vue +590 -0
- package/src/uni-ui/lib/uni-easyinput/common.js +54 -0
- package/src/uni-ui/lib/uni-easyinput/uni-easyinput.vue +790 -0
- package/src/uni-ui/lib/uni-forms-item/uni-forms-item.vue +630 -0
- package/src/uni-ui/lib/uni-goods-nav/i18n/en.json +6 -0
- package/src/uni-ui/lib/uni-goods-nav/i18n/index.js +8 -0
- package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hans.json +6 -0
- package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hant.json +6 -0
- package/src/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +231 -0
- package/src/uni-ui/lib/uni-icons/uni-icons.uvue +91 -0
- package/src/uni-ui/lib/uni-icons/uni-icons.vue +114 -0
- package/src/uni-ui/lib/uni-icons/uniicons.css +664 -0
- package/src/uni-ui/lib/uni-icons/uniicons.ttf +0 -0
- package/src/uni-ui/lib/uni-icons/uniicons_file.ts +664 -0
- package/src/uni-ui/lib/uni-icons/uniicons_file_vue.js +649 -0
- package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +144 -0
- package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +404 -0
- package/src/uni-ui/lib/uni-list/uni-list.vue +123 -0
- package/src/uni-ui/lib/uni-list/uni-refresh.vue +65 -0
- package/src/uni-ui/lib/uni-list/uni-refresh.wxs +87 -0
- package/src/uni-ui/lib/uni-popup-dialog/keypress.js +45 -0
- package/src/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +324 -0
- package/src/uni-ui/lib/uni-rate/uni-rate.vue +361 -0
- package/src/uni-ui/lib/uni-table/uni-table.vue +496 -0
- package/src/uni-ui/lib/uni-td/uni-td.vue +99 -0
- package/src/uni-ui/lib/uni-th/uni-th.vue +310 -283
- package/src/uni-ui/lib/uni-tr/uni-tr.vue +194 -170
- package/src/version.ts +2 -2
- package/dist/deps/@vtj/uni/index.umd.js +0 -7
package/src/uni-ui/index.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import './polyfill';
|
2
2
|
import type { App } from 'vue';
|
3
3
|
import './lib/uni.scss';
|
4
|
+
|
4
5
|
import UniBadge from '@dcloudio/uni-ui/lib/uni-badge/uni-badge.vue';
|
5
6
|
import UniBreadcrumb from '@dcloudio/uni-ui/lib/uni-breadcrumb/uni-breadcrumb.vue';
|
6
7
|
import UniBreadcrumbItem from '@dcloudio/uni-ui/lib/uni-breadcrumb-item/uni-breadcrumb-item.vue';
|
@@ -13,28 +14,36 @@ import UniCountdown from '@dcloudio/uni-ui/lib/uni-countdown/uni-countdown.vue';
|
|
13
14
|
import UniDataCheckbox from '@dcloudio/uni-ui/lib/uni-data-checkbox/uni-data-checkbox.vue';
|
14
15
|
import UniDataPicker from '@dcloudio/uni-ui/lib/uni-data-picker/uni-data-picker.vue';
|
15
16
|
import UniDataPickerview from '@dcloudio/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue';
|
16
|
-
import UniDataSelect from '@dcloudio/uni-ui/lib/uni-data-select/uni-data-select.vue';
|
17
|
+
// import UniDataSelect from '@dcloudio/uni-ui/lib/uni-data-select/uni-data-select.vue';
|
18
|
+
import UniDataSelect from './lib/uni-data-select/uni-data-select.vue';
|
17
19
|
import UniDateformat from '@dcloudio/uni-ui/lib/uni-dateformat/uni-dateformat.vue';
|
18
20
|
//? 编译器 原因: 声明了变量多次。第618-620行。
|
19
21
|
// import UniDatetimePicker from '@dcloudio/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue';
|
20
22
|
import UniDatetimePicker from './lib/uni-datetime-picker/uni-datetime-picker.vue';
|
21
23
|
//? css 参数。 $uni-bg-color异常。 scss 问题 处理不了 $ 变量
|
22
24
|
import UniDrawer from '@dcloudio/uni-ui/lib/uni-drawer/uni-drawer.vue';
|
23
|
-
|
25
|
+
//? 条件编译 出现两个组件
|
26
|
+
// import UniEasyinput from '@dcloudio/uni-ui/lib/uni-easyinput/uni-easyinput.vue';
|
27
|
+
import UniEasyinput from './lib/uni-easyinput/uni-easyinput.vue';
|
24
28
|
import UniFob from '@dcloudio/uni-ui/lib/uni-fab/uni-fab.vue';
|
25
29
|
import UniFov from '@dcloudio/uni-ui/lib/uni-fav/uni-fav.vue';
|
26
30
|
import UniFilePicker from '@dcloudio/uni-ui/lib/uni-file-picker/uni-file-picker.vue';
|
27
31
|
import UniForms from './lib/uni-forms/uni-forms.vue';
|
28
|
-
|
32
|
+
//? 条件编译 出现两个组件
|
33
|
+
// import UniFormsItem from '@dcloudio/uni-ui/lib/uni-forms-item/uni-forms-item.vue';
|
34
|
+
import UniFormsItem from './lib/uni-forms-item/uni-forms-item.vue';
|
29
35
|
import UniGoodsNav from '@dcloudio/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue';
|
30
36
|
import UniGrid from '@dcloudio/uni-ui/lib/uni-grid/uni-grid.vue';
|
31
37
|
import UniGridItem from '@dcloudio/uni-ui/lib/uni-grid-item/uni-grid-item.vue';
|
32
38
|
import UniGroup from '@dcloudio/uni-ui/lib/uni-group/uni-group.vue';
|
33
|
-
import UniIcons from '@dcloudio/uni-ui/lib/uni-icons/uni-icons.vue';
|
39
|
+
// import UniIcons from '@dcloudio/uni-ui/lib/uni-icons/uni-icons.vue';
|
40
|
+
import UniIcons from './lib/uni-icons/uni-icons.vue';
|
34
41
|
//? css 参数。 scss 问题 处理不了 $ 变量
|
35
|
-
import UniIndexedList from '@dcloudio/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue';
|
42
|
+
// import UniIndexedList from '@dcloudio/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue';
|
43
|
+
import UniIndexedList from './lib/uni-indexed-list/uni-indexed-list.vue';
|
36
44
|
import UniLink from '@dcloudio/uni-ui/lib/uni-link/uni-link.vue';
|
37
|
-
import UniList from '@dcloudio/uni-ui/lib/uni-list/uni-list.vue';
|
45
|
+
// import UniList from '@dcloudio/uni-ui/lib/uni-list/uni-list.vue';
|
46
|
+
import UniList from './lib/uni-list/uni-list.vue';
|
38
47
|
import UniListItem from '@dcloudio/uni-ui/lib/uni-list-item/uni-list-item.vue';
|
39
48
|
import UniListChat from '@dcloudio/uni-ui/lib/uni-list-chat/uni-list-chat.vue';
|
40
49
|
//? css 参数。。 scss 问题 处理不了 $ 变量
|
@@ -50,9 +59,11 @@ import UniPopup from './lib/uni-popup/uni-popup.vue';
|
|
50
59
|
import UniPopupMessage from '@dcloudio/uni-ui/lib/uni-popup-message/uni-popup-message.vue';
|
51
60
|
import UniPopupDialog from '@dcloudio/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue';
|
52
61
|
import UniPopupShare from '@dcloudio/uni-ui/lib/uni-popup-share/uni-popup-share.vue';
|
53
|
-
import UniRate from '@dcloudio/uni-ui/lib/uni-rate/uni-rate.vue';
|
62
|
+
// import UniRate from '@dcloudio/uni-ui/lib/uni-rate/uni-rate.vue';
|
63
|
+
import UniRate from './lib/uni-rate/uni-rate.vue';
|
54
64
|
import UniRow from '@dcloudio/uni-ui/lib/uni-row/uni-row.vue';
|
55
|
-
import UniCol from '@dcloudio/uni-ui/lib/uni-col/uni-col.vue';
|
65
|
+
// import UniCol from '@dcloudio/uni-ui/lib/uni-col/uni-col.vue';
|
66
|
+
import UniCol from './lib/uni-col/uni-col.vue';
|
56
67
|
import UniSearchBar from '@dcloudio/uni-ui/lib/uni-search-bar/uni-search-bar.vue';
|
57
68
|
import UniSection from '@dcloudio/uni-ui/lib/uni-section/uni-section.vue';
|
58
69
|
import UniSegmentedControl from '@dcloudio/uni-ui/lib/uni-segmented-control/uni-segmented-control.vue';
|
@@ -62,19 +73,23 @@ import UniSwipeAction from '@dcloudio/uni-ui/lib/uni-swipe-action/uni-swipe-acti
|
|
62
73
|
// import UniSwipeActionItem from '@dcloudio/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue';
|
63
74
|
import UniSwipeActionItem from './lib/uni-swipe-action-item/uni-swipe-action-item.vue';
|
64
75
|
import UniSwiperDot from '@dcloudio/uni-ui/lib/uni-swiper-dot/uni-swiper-dot.vue';
|
65
|
-
import UniTable from '@dcloudio/uni-ui/lib/uni-table/uni-table.vue';
|
76
|
+
// import UniTable from '@dcloudio/uni-ui/lib/uni-table/uni-table.vue';
|
77
|
+
import UniTable from './lib/uni-table/uni-table.vue';
|
66
78
|
import UniThead from '@dcloudio/uni-ui/lib/uni-thead/uni-thead.vue';
|
67
79
|
import UniTBody from '@dcloudio/uni-ui/lib/uni-tbody/uni-tbody.vue';
|
68
|
-
import UniTr from '@dcloudio/uni-ui/lib/uni-tr/uni-tr.vue';
|
80
|
+
// import UniTr from '@dcloudio/uni-ui/lib/uni-tr/uni-tr.vue';
|
81
|
+
import UniTr from './lib/uni-tr/uni-tr.vue';
|
69
82
|
//? 编译器 原因: 声明了变量多次。 第119行
|
70
83
|
// import UniTh from '@dcloudio/uni-ui/lib/uni-th/uni-th.vue';
|
71
84
|
import UniTh from './lib/uni-th/uni-th.vue';
|
72
|
-
import UniTd from '
|
85
|
+
import UniTd from './lib/uni-td/uni-td.vue';
|
73
86
|
import UniTag from '@dcloudio/uni-ui/lib/uni-tag/uni-tag.vue';
|
74
87
|
import UniTitle from '@dcloudio/uni-ui/lib/uni-title/uni-title.vue';
|
75
88
|
import UniTooltip from '@dcloudio/uni-ui/lib/uni-tooltip/uni-tooltip.vue';
|
76
89
|
import UniTransition from '@dcloudio/uni-ui/lib/uni-transition/uni-transition.vue';
|
77
90
|
|
91
|
+
import UniuniPopupDialog from './lib/uni-popup-dialog/uni-popup-dialog.vue';
|
92
|
+
|
78
93
|
// 62
|
79
94
|
const components = {
|
80
95
|
UniBadge,
|
@@ -138,7 +153,8 @@ const components = {
|
|
138
153
|
UniTag,
|
139
154
|
UniTitle,
|
140
155
|
UniTooltip,
|
141
|
-
UniTransition
|
156
|
+
UniTransition,
|
157
|
+
UniuniPopupDialog
|
142
158
|
};
|
143
159
|
|
144
160
|
export {
|
@@ -203,7 +219,8 @@ export {
|
|
203
219
|
UniTag,
|
204
220
|
UniTitle,
|
205
221
|
UniTooltip,
|
206
|
-
UniTransition
|
222
|
+
UniTransition,
|
223
|
+
UniuniPopupDialog
|
207
224
|
};
|
208
225
|
|
209
226
|
export function install(app: App) {
|
@@ -0,0 +1,324 @@
|
|
1
|
+
<template>
|
2
|
+
<!-- #ifndef APP-NVUE -->
|
3
|
+
<view
|
4
|
+
:class="['uni-col', sizeClass, pointClassList]"
|
5
|
+
:style="{
|
6
|
+
paddingLeft: `${Number(gutter)}rpx`,
|
7
|
+
paddingRight: `${Number(gutter)}rpx`
|
8
|
+
}">
|
9
|
+
<slot></slot>
|
10
|
+
</view>
|
11
|
+
<!-- #endif -->
|
12
|
+
<!-- #ifdef APP-NVUE -->
|
13
|
+
<!-- 在nvue上,类名样式不生效,换为style -->
|
14
|
+
<!-- 设置right正值失效,设置 left 负值 -->
|
15
|
+
<!-- <view :class="['uni-col']" :style="{
|
16
|
+
paddingLeft:`${Number(gutter)}rpx`,
|
17
|
+
paddingRight:`${Number(gutter)}rpx`,
|
18
|
+
width:`${nvueWidth}rpx`,
|
19
|
+
position:'relative',
|
20
|
+
marginLeft:`${marginLeft}rpx`,
|
21
|
+
left:`${right === 0 ? left : -right}rpx`
|
22
|
+
}">
|
23
|
+
<slot></slot>
|
24
|
+
</view> -->
|
25
|
+
<!-- #endif -->
|
26
|
+
</template>
|
27
|
+
|
28
|
+
<script>
|
29
|
+
/**
|
30
|
+
* Col 布局-列
|
31
|
+
* @description 搭配uni-row使用,构建布局。
|
32
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=3958
|
33
|
+
*
|
34
|
+
* @property {span} type = Number 栅格占据的列数
|
35
|
+
* 默认 24
|
36
|
+
* @property {offset} type = Number 栅格左侧的间隔格数
|
37
|
+
* @property {push} type = Number 栅格向右移动格数
|
38
|
+
* @property {pull} type = Number 栅格向左移动格数
|
39
|
+
* @property {xs} type = [Number, Object] <768px 响应式栅格数或者栅格属性对象
|
40
|
+
* @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
|
41
|
+
* @property {sm} type = [Number, Object] ≥768px 响应式栅格数或者栅格属性对象
|
42
|
+
* @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
|
43
|
+
* @property {md} type = [Number, Object] ≥992px 响应式栅格数或者栅格属性对象
|
44
|
+
* @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
|
45
|
+
* @property {lg} type = [Number, Object] ≥1200px 响应式栅格数或者栅格属性对象
|
46
|
+
* @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
|
47
|
+
* @property {xl} type = [Number, Object] ≥1920px 响应式栅格数或者栅格属性对象
|
48
|
+
* @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
|
49
|
+
*/
|
50
|
+
const ComponentClass = 'uni-col';
|
51
|
+
|
52
|
+
// -1 默认值,因为在微信小程序端只给Number会有默认值0
|
53
|
+
export default {
|
54
|
+
name: 'uniCol',
|
55
|
+
// #ifdef MP-WEIXIN
|
56
|
+
options: {
|
57
|
+
virtualHost: true // 在微信小程序中将组件节点渲染为虚拟节点,更加接近Vue组件的表现
|
58
|
+
},
|
59
|
+
// #endif
|
60
|
+
props: {
|
61
|
+
span: {
|
62
|
+
type: Number,
|
63
|
+
default: 24
|
64
|
+
},
|
65
|
+
offset: {
|
66
|
+
type: Number,
|
67
|
+
default: -1
|
68
|
+
},
|
69
|
+
pull: {
|
70
|
+
type: Number,
|
71
|
+
default: -1
|
72
|
+
},
|
73
|
+
push: {
|
74
|
+
type: Number,
|
75
|
+
default: -1
|
76
|
+
},
|
77
|
+
xs: [Number, Object],
|
78
|
+
sm: [Number, Object],
|
79
|
+
md: [Number, Object],
|
80
|
+
lg: [Number, Object],
|
81
|
+
xl: [Number, Object]
|
82
|
+
},
|
83
|
+
data() {
|
84
|
+
return {
|
85
|
+
gutter: 0,
|
86
|
+
sizeClass: '',
|
87
|
+
parentWidth: 0,
|
88
|
+
nvueWidth: 0,
|
89
|
+
marginLeft: 0,
|
90
|
+
right: 0,
|
91
|
+
left: 0
|
92
|
+
};
|
93
|
+
},
|
94
|
+
created() {
|
95
|
+
// 字节小程序中,在computed中读取$parent为undefined
|
96
|
+
let parent = this.$parent;
|
97
|
+
|
98
|
+
while (parent && parent.$options.componentName !== 'uniRow') {
|
99
|
+
parent = parent.$parent;
|
100
|
+
}
|
101
|
+
|
102
|
+
this.updateGutter(parent.gutter);
|
103
|
+
parent.$watch('gutter', (gutter) => {
|
104
|
+
this.updateGutter(gutter);
|
105
|
+
});
|
106
|
+
|
107
|
+
// #ifdef APP-NVUE
|
108
|
+
this.updateNvueWidth(parent.width);
|
109
|
+
parent.$watch('width', (width) => {
|
110
|
+
this.updateNvueWidth(width);
|
111
|
+
});
|
112
|
+
// #endif
|
113
|
+
},
|
114
|
+
computed: {
|
115
|
+
sizeList() {
|
116
|
+
let { span, offset, pull, push } = this;
|
117
|
+
|
118
|
+
return {
|
119
|
+
span,
|
120
|
+
offset,
|
121
|
+
pull,
|
122
|
+
push
|
123
|
+
};
|
124
|
+
},
|
125
|
+
// #ifndef APP-NVUE
|
126
|
+
pointClassList() {
|
127
|
+
let classList = [];
|
128
|
+
|
129
|
+
['xs', 'sm', 'md', 'lg', 'xl'].forEach((point) => {
|
130
|
+
const props = this[point];
|
131
|
+
if (typeof props === 'number') {
|
132
|
+
classList.push(`${ComponentClass}-${point}-${props}`);
|
133
|
+
} else if (typeof props === 'object' && props) {
|
134
|
+
Object.keys(props).forEach((pointProp) => {
|
135
|
+
classList.push(
|
136
|
+
pointProp === 'span'
|
137
|
+
? `${ComponentClass}-${point}-${props[pointProp]}`
|
138
|
+
: `${ComponentClass}-${point}-${pointProp}-${props[pointProp]}`
|
139
|
+
);
|
140
|
+
});
|
141
|
+
}
|
142
|
+
});
|
143
|
+
|
144
|
+
// 支付宝小程序使用 :class=[ ['a','b'] ],渲染错误
|
145
|
+
return classList.join(' ');
|
146
|
+
}
|
147
|
+
// #endif
|
148
|
+
},
|
149
|
+
methods: {
|
150
|
+
updateGutter(parentGutter) {
|
151
|
+
parentGutter = Number(parentGutter);
|
152
|
+
if (!isNaN(parentGutter)) {
|
153
|
+
this.gutter = parentGutter / 2;
|
154
|
+
}
|
155
|
+
},
|
156
|
+
// #ifdef APP-NVUE
|
157
|
+
updateNvueWidth(width) {
|
158
|
+
// 用于在nvue端,span,offset,pull,push的计算
|
159
|
+
this.parentWidth = width;
|
160
|
+
['span', 'offset', 'pull', 'push'].forEach((size) => {
|
161
|
+
const curSize = this[size];
|
162
|
+
if ((curSize || curSize === 0) && curSize !== -1) {
|
163
|
+
let RPX = (1 / 24) * curSize * width;
|
164
|
+
RPX = Number(RPX);
|
165
|
+
switch (size) {
|
166
|
+
case 'span':
|
167
|
+
this.nvueWidth = RPX;
|
168
|
+
break;
|
169
|
+
case 'offset':
|
170
|
+
this.marginLeft = RPX;
|
171
|
+
break;
|
172
|
+
case 'pull':
|
173
|
+
this.right = RPX;
|
174
|
+
break;
|
175
|
+
case 'push':
|
176
|
+
this.left = RPX;
|
177
|
+
break;
|
178
|
+
}
|
179
|
+
}
|
180
|
+
});
|
181
|
+
}
|
182
|
+
// #endif
|
183
|
+
},
|
184
|
+
watch: {
|
185
|
+
sizeList: {
|
186
|
+
immediate: true,
|
187
|
+
handler(newVal) {
|
188
|
+
// #ifndef APP-NVUE
|
189
|
+
let classList = [];
|
190
|
+
for (let size in newVal) {
|
191
|
+
const curSize = newVal[size];
|
192
|
+
if ((curSize || curSize === 0) && curSize !== -1) {
|
193
|
+
classList.push(
|
194
|
+
size === 'span'
|
195
|
+
? `${ComponentClass}-${curSize}`
|
196
|
+
: `${ComponentClass}-${size}-${curSize}`
|
197
|
+
);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
// 支付宝小程序使用 :class=[ ['a','b'] ],渲染错误
|
201
|
+
this.sizeClass = classList.join(' ');
|
202
|
+
// #endif
|
203
|
+
// #ifdef APP-NVUE
|
204
|
+
this.updateNvueWidth(this.parentWidth);
|
205
|
+
// #endif
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}
|
209
|
+
};
|
210
|
+
</script>
|
211
|
+
|
212
|
+
<style lang="scss" scoped>
|
213
|
+
/* breakpoints */
|
214
|
+
$--sm: 768px !default;
|
215
|
+
$--md: 992px !default;
|
216
|
+
$--lg: 1200px !default;
|
217
|
+
$--xl: 1920px !default;
|
218
|
+
|
219
|
+
$breakpoints: (
|
220
|
+
'xs': (
|
221
|
+
max-width: $--sm - 1
|
222
|
+
),
|
223
|
+
'sm': (
|
224
|
+
min-width: $--sm
|
225
|
+
),
|
226
|
+
'md': (
|
227
|
+
min-width: $--md
|
228
|
+
),
|
229
|
+
'lg': (
|
230
|
+
min-width: $--lg
|
231
|
+
),
|
232
|
+
'xl': (
|
233
|
+
min-width: $--xl
|
234
|
+
)
|
235
|
+
);
|
236
|
+
|
237
|
+
$layout-namespace: '.uni-';
|
238
|
+
$col: $layout-namespace + 'col';
|
239
|
+
|
240
|
+
@function getSize($size) {
|
241
|
+
/* TODO 1/24 * $size * 100 * 1%; 使用计算后的值,为了解决 vue3 控制台报错 */
|
242
|
+
@return 0.04166666666 * $size * 100 * 1%;
|
243
|
+
}
|
244
|
+
|
245
|
+
@mixin res($key, $map: $breakpoints) {
|
246
|
+
@if map-has-key($map, $key) {
|
247
|
+
@media screen and #{inspect(map-get($map,$key))} {
|
248
|
+
@content;
|
249
|
+
}
|
250
|
+
} @else {
|
251
|
+
@warn "Undeinfed point: `#{$key}`";
|
252
|
+
}
|
253
|
+
}
|
254
|
+
|
255
|
+
/* #ifndef APP-NVUE */
|
256
|
+
#{$col} {
|
257
|
+
float: left;
|
258
|
+
box-sizing: border-box;
|
259
|
+
}
|
260
|
+
|
261
|
+
#{$col}-0 {
|
262
|
+
/* #ifdef APP-NVUE */
|
263
|
+
width: 0;
|
264
|
+
height: 0;
|
265
|
+
margin-top: 0;
|
266
|
+
margin-right: 0;
|
267
|
+
margin-bottom: 0;
|
268
|
+
margin-left: 0;
|
269
|
+
/* #endif */
|
270
|
+
/* #ifndef APP-NVUE */
|
271
|
+
display: none;
|
272
|
+
/* #endif */
|
273
|
+
}
|
274
|
+
|
275
|
+
@for $i from 0 through 24 {
|
276
|
+
#{$col}-#{$i} {
|
277
|
+
width: getSize($i);
|
278
|
+
}
|
279
|
+
|
280
|
+
#{$col}-offset-#{$i} {
|
281
|
+
margin-left: getSize($i);
|
282
|
+
}
|
283
|
+
|
284
|
+
#{$col}-pull-#{$i} {
|
285
|
+
position: relative;
|
286
|
+
right: getSize($i);
|
287
|
+
}
|
288
|
+
|
289
|
+
#{$col}-push-#{$i} {
|
290
|
+
position: relative;
|
291
|
+
left: getSize($i);
|
292
|
+
}
|
293
|
+
}
|
294
|
+
|
295
|
+
@each $point in map-keys($breakpoints) {
|
296
|
+
@include res($point) {
|
297
|
+
#{$col}-#{$point}-0 {
|
298
|
+
display: none;
|
299
|
+
}
|
300
|
+
|
301
|
+
@for $i from 0 through 24 {
|
302
|
+
#{$col}-#{$point}-#{$i} {
|
303
|
+
width: getSize($i);
|
304
|
+
}
|
305
|
+
|
306
|
+
#{$col}-#{$point}-offset-#{$i} {
|
307
|
+
margin-left: getSize($i);
|
308
|
+
}
|
309
|
+
|
310
|
+
#{$col}-#{$point}-pull-#{$i} {
|
311
|
+
position: relative;
|
312
|
+
right: getSize($i);
|
313
|
+
}
|
314
|
+
|
315
|
+
#{$col}-#{$point}-push-#{$i} {
|
316
|
+
position: relative;
|
317
|
+
left: getSize($i);
|
318
|
+
}
|
319
|
+
}
|
320
|
+
}
|
321
|
+
}
|
322
|
+
|
323
|
+
/* #endif */
|
324
|
+
</style>
|