优化目录结构
158
manifest.json
@@ -1,73 +1,89 @@
|
|||||||
{
|
{
|
||||||
"name" : "uniapp-imitate-wx",
|
"name": "uniapp-imitate-wx",
|
||||||
"appid" : "__UNI__9EFDC69",
|
"appid": "__UNI__9EFDC69",
|
||||||
"description" : "",
|
"description": "",
|
||||||
"versionName" : "1.0.0",
|
"versionName": "1.0.0",
|
||||||
"versionCode" : "100",
|
"versionCode": "100",
|
||||||
"transformPx" : false,
|
"transformPx": false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus": {
|
||||||
"usingComponents" : true,
|
"usingComponents": true,
|
||||||
"nvueStyleCompiler" : "uni-app",
|
"nvueStyleCompiler": "uni-app",
|
||||||
"compilerVersion" : 3,
|
"compilerVersion": 3,
|
||||||
"splashscreen" : {
|
"splashscreen": {
|
||||||
"alwaysShowBeforeRender" : true,
|
"alwaysShowBeforeRender": true,
|
||||||
"waiting" : true,
|
"waiting": true,
|
||||||
"autoclose" : true,
|
"autoclose": true,
|
||||||
"delay" : 0
|
"delay": 0
|
||||||
},
|
},
|
||||||
/* 模块配置 */
|
"safearea": {
|
||||||
"modules" : {},
|
"background": "#ffffff",
|
||||||
/* 应用发布信息 */
|
"backgroundDark": "#2f0508",
|
||||||
"distribute" : {
|
"bottom": {
|
||||||
/* android打包配置 */
|
"offset": "none"
|
||||||
"android" : {
|
}
|
||||||
"permissions" : [
|
},
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
/* 模块配置 */
|
||||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
"modules": {},
|
||||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
/* 应用发布信息 */
|
||||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
"distribute": {
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
/* android打包配置 */
|
||||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
"android": {
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
"permissions": [
|
||||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||||
]
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
},
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
/* ios打包配置 */
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||||
"ios" : {},
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||||
/* SDK配置 */
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
"sdkConfigs" : {}
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
}
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
},
|
]
|
||||||
/* 快应用特有相关 */
|
},
|
||||||
"quickapp" : {},
|
/* ios打包配置 */
|
||||||
/* 小程序特有相关 */
|
"ios": {},
|
||||||
"mp-weixin" : {
|
/* SDK配置 */
|
||||||
"appid" : "",
|
"sdkConfigs": {}
|
||||||
"setting" : {
|
}
|
||||||
"urlCheck" : false
|
},
|
||||||
},
|
"app-harmony": {
|
||||||
"usingComponents" : true
|
"safearea": { // HarmonyOS 平台的安全区域
|
||||||
},
|
"background": "#ffffff",
|
||||||
"mp-alipay" : {
|
"backgroundDark": "#2f0508",
|
||||||
"usingComponents" : true
|
"bottom": {
|
||||||
},
|
"offset": "none" // 在没有 tabBar 时,底部区域是否需要占位
|
||||||
"mp-baidu" : {
|
}
|
||||||
"usingComponents" : true
|
}
|
||||||
},
|
},
|
||||||
"mp-toutiao" : {
|
/* 快应用特有相关 */
|
||||||
"usingComponents" : true
|
"quickapp": {},
|
||||||
},
|
/* 小程序特有相关 */
|
||||||
"uniStatistics" : {
|
"mp-weixin": {
|
||||||
"enable" : false
|
"appid": "",
|
||||||
},
|
"setting": {
|
||||||
"vueVersion" : "3",
|
"urlCheck": false
|
||||||
"fallbackLocale" : "zh-Hans"
|
},
|
||||||
|
"usingComponents": true
|
||||||
|
},
|
||||||
|
"mp-alipay": {
|
||||||
|
"usingComponents": true
|
||||||
|
},
|
||||||
|
"mp-baidu": {
|
||||||
|
"usingComponents": true
|
||||||
|
},
|
||||||
|
"mp-toutiao": {
|
||||||
|
"usingComponents": true
|
||||||
|
},
|
||||||
|
"uniStatistics": {
|
||||||
|
"enable": false
|
||||||
|
},
|
||||||
|
"vueVersion": "3",
|
||||||
|
"fallbackLocale": "zh-Hans"
|
||||||
}
|
}
|
||||||
@@ -121,6 +121,13 @@
|
|||||||
"navigationBarTitleText": "排行榜",
|
"navigationBarTitleText": "排行榜",
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/discover/punch",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "签到",
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
|
|||||||
@@ -16,6 +16,10 @@
|
|||||||
navigateTo('/pages/discover/ranking-list')
|
navigateTo('/pages/discover/ranking-list')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (item === 'sign') {
|
||||||
|
navigateTo('/pages/discover/punch')
|
||||||
|
return
|
||||||
|
}
|
||||||
if (item === 'mall') {
|
if (item === 'mall') {
|
||||||
navigateTo('/pages/mall/list')
|
navigateTo('/pages/mall/list')
|
||||||
return
|
return
|
||||||
|
|||||||
31
pages/discover/punch.vue
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<script setup></script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="punch">
|
||||||
|
<nav-bar>
|
||||||
|
<template #back>
|
||||||
|
<image
|
||||||
|
src="/static/images/public/return-icon.png"
|
||||||
|
mode="heightFix"
|
||||||
|
class="top-left-icon"
|
||||||
|
></image>
|
||||||
|
</template>
|
||||||
|
</nav-bar>
|
||||||
|
<view class="public-header—box">
|
||||||
|
<!-- <image
|
||||||
|
src="/static/images/ranking-list/title-icon.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
class="left-icon"
|
||||||
|
></image>
|
||||||
|
<image
|
||||||
|
src="/static/images/ranking-list/hat.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
class="right-icon"
|
||||||
|
></image> -->
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import './styles/index.scss';
|
||||||
|
</style>
|
||||||
@@ -5,20 +5,20 @@
|
|||||||
<nav-bar>
|
<nav-bar>
|
||||||
<template #back>
|
<template #back>
|
||||||
<image
|
<image
|
||||||
src="/static/images/public/white-arrow.png"
|
src="/static/images/public/return-icon.png"
|
||||||
mode="heightFix"
|
mode="heightFix"
|
||||||
class="top-left-icon"
|
class="top-left-icon"
|
||||||
></image>
|
></image>
|
||||||
</template>
|
</template>
|
||||||
</nav-bar>
|
</nav-bar>
|
||||||
<view class="top-box">
|
<view class="public-header—box">
|
||||||
<image
|
<image
|
||||||
src="/static/images/ranking-list/title-icon.png"
|
src="/static/images/discover/title-icon.png"
|
||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
class="left-icon"
|
class="left-icon"
|
||||||
></image>
|
></image>
|
||||||
<image
|
<image
|
||||||
src="/static/images/ranking-list/hat.png"
|
src="/static/images/discover/hat.png"
|
||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
class="right-icon"
|
class="right-icon"
|
||||||
></image>
|
></image>
|
||||||
@@ -27,68 +27,122 @@
|
|||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<view class="table-box">
|
<view class="table-box">
|
||||||
<!-- 表头 -->
|
<!-- 表头 -->
|
||||||
<view class="table-head">
|
<uni-row class="table-head">
|
||||||
<view class="table-item">
|
<uni-col :span="6">
|
||||||
<text class="item-text">排行</text>
|
<view class="grade-box">
|
||||||
</view>
|
<text class="item-text">排行</text>
|
||||||
<view class="table-item">
|
</view>
|
||||||
<text class="item-text">用户</text>
|
</uni-col>
|
||||||
</view>
|
<uni-col :span="12">
|
||||||
<view class="table-item">
|
<view class="name">
|
||||||
<text class="item-text">积分</text>
|
<text class="item-text">用户</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</uni-col>
|
||||||
|
<uni-col :span="6">
|
||||||
|
<view class="table-right">
|
||||||
|
<text class="item-text">积分</text>
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
<!-- 列表内容 -->
|
<!-- 列表内容 -->
|
||||||
<view v-for="item in 4" class="table-content">
|
<uni-row
|
||||||
<view class="table-item">
|
v-for="(item, index) in 19"
|
||||||
<text class="item-text">1</text>
|
:key="index"
|
||||||
</view>
|
class="table-content"
|
||||||
<view class="table-item">
|
>
|
||||||
<text class="item-text">张三</text>
|
<uni-col :span="6">
|
||||||
</view>
|
<view class="grade-box">
|
||||||
<view class="table-item">
|
<image
|
||||||
<text class="item-text">100</text>
|
v-if="index < 3"
|
||||||
</view>
|
:src="`/static/images/discover/grade${index + 1}.png`"
|
||||||
</view>
|
mode="heightFix"
|
||||||
|
class="grade"
|
||||||
|
></image>
|
||||||
|
<text v-else class="item-text">1</text>
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="12">
|
||||||
|
<view class="table-name">
|
||||||
|
<image
|
||||||
|
src="/static/images/public/random2.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
class="left-icon"
|
||||||
|
></image>
|
||||||
|
<view class="name">
|
||||||
|
<text>张三</text>
|
||||||
|
<text>158****98874</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="6">
|
||||||
|
<view class="table-right">
|
||||||
|
<text class="item-text">100</text>
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.top-left-icon {
|
@import './styles/index.scss';
|
||||||
height: 42rpx;
|
|
||||||
}
|
|
||||||
.top-box {
|
|
||||||
position: relative;
|
|
||||||
height: 466rpx;
|
|
||||||
background: linear-gradient(0deg, #00d993 0%, #00d9c5 100%);
|
|
||||||
&::after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 38rpx;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: #ffffff;
|
|
||||||
border-radius: 32rpx 32rpx 0rpx 0rpx;
|
|
||||||
}
|
|
||||||
.left-icon {
|
|
||||||
width: 354rpx;
|
|
||||||
height: 166rpx;
|
|
||||||
position: absolute;
|
|
||||||
bottom: 42rpx;
|
|
||||||
left: 48rpx;
|
|
||||||
}
|
|
||||||
.right-icon {
|
|
||||||
width: 450rpx;
|
|
||||||
height: 218rpx;
|
|
||||||
position: absolute;
|
|
||||||
bottom: 10rpx;
|
|
||||||
right: -60rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-box {
|
.table-box {
|
||||||
|
font-family: PingFang SC, PingFang SC;
|
||||||
|
font-style: normal;
|
||||||
|
text-transform: none;
|
||||||
|
.grade-box {
|
||||||
|
text-align: center;
|
||||||
|
.grade {
|
||||||
|
height: 64rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.table-right {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.table-head {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999999;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
padding-left: 18rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.table-content {
|
||||||
|
margin-top: 36rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.table-name {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.left-icon {
|
||||||
|
width: 64rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
margin-right: 8rpx;
|
||||||
|
}
|
||||||
|
.name {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
text {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 1;
|
||||||
|
&:last-child {
|
||||||
|
margin-top: 8rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.table-right {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
34
pages/discover/styles/index.scss
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
// 通用头部
|
||||||
|
.public-header—box {
|
||||||
|
position: relative;
|
||||||
|
height: 416rpx;
|
||||||
|
background: linear-gradient(0deg, #00d993 0%, #00d9c5 100%);
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 38rpx;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 32rpx 32rpx 0rpx 0rpx;
|
||||||
|
}
|
||||||
|
.left-icon {
|
||||||
|
width: 354rpx;
|
||||||
|
height: 166rpx;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 42rpx;
|
||||||
|
left: 48rpx;
|
||||||
|
}
|
||||||
|
.right-icon {
|
||||||
|
width: 450rpx;
|
||||||
|
height: 218rpx;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10rpx;
|
||||||
|
right: -60rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-left-icon {
|
||||||
|
height: 42rpx;
|
||||||
|
}
|
||||||
BIN
static/images/discover/grade1.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
static/images/discover/grade2.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
static/images/discover/grade3.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
10
uni_modules/uni-row/changelog.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
## 1.0.0(2021-11-19)
|
||||||
|
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
||||||
|
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-row](https://uniapp.dcloud.io/component/uniui/uni-row)
|
||||||
|
## 0.1.0(2021-07-13)
|
||||||
|
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
|
||||||
|
## 0.0.4(2021-05-12)
|
||||||
|
- 新增 组件示例地址
|
||||||
|
## 0.0.3(2021-02-05)
|
||||||
|
- 调整为uni_modules目录规范
|
||||||
|
- 新增uni-row组件
|
||||||
317
uni_modules/uni-row/components/uni-col/uni-col.vue
Normal file
@@ -0,0 +1,317 @@
|
|||||||
|
<template>
|
||||||
|
<!-- #ifndef APP-NVUE -->
|
||||||
|
<view :class="['uni-col', sizeClass, pointClassList]" :style="{
|
||||||
|
paddingLeft:`${Number(gutter)}rpx`,
|
||||||
|
paddingRight:`${Number(gutter)}rpx`,
|
||||||
|
}">
|
||||||
|
<slot></slot>
|
||||||
|
</view>
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef APP-NVUE -->
|
||||||
|
<!-- 在nvue上,类名样式不生效,换为style -->
|
||||||
|
<!-- 设置right正值失效,设置 left 负值 -->
|
||||||
|
<view :class="['uni-col']" :style="{
|
||||||
|
paddingLeft:`${Number(gutter)}rpx`,
|
||||||
|
paddingRight:`${Number(gutter)}rpx`,
|
||||||
|
width:`${nvueWidth}rpx`,
|
||||||
|
position:'relative',
|
||||||
|
marginLeft:`${marginLeft}rpx`,
|
||||||
|
left:`${right === 0 ? left : -right}rpx`
|
||||||
|
}">
|
||||||
|
<slot></slot>
|
||||||
|
</view>
|
||||||
|
<!-- #endif -->
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* Col 布局-列
|
||||||
|
* @description 搭配uni-row使用,构建布局。
|
||||||
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=3958
|
||||||
|
*
|
||||||
|
* @property {span} type = Number 栅格占据的列数
|
||||||
|
* 默认 24
|
||||||
|
* @property {offset} type = Number 栅格左侧的间隔格数
|
||||||
|
* @property {push} type = Number 栅格向右移动格数
|
||||||
|
* @property {pull} type = Number 栅格向左移动格数
|
||||||
|
* @property {xs} type = [Number, Object] <768px 响应式栅格数或者栅格属性对象
|
||||||
|
* @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
|
||||||
|
* @property {sm} type = [Number, Object] ≥768px 响应式栅格数或者栅格属性对象
|
||||||
|
* @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
|
||||||
|
* @property {md} type = [Number, Object] ≥992px 响应式栅格数或者栅格属性对象
|
||||||
|
* @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
|
||||||
|
* @property {lg} type = [Number, Object] ≥1200px 响应式栅格数或者栅格属性对象
|
||||||
|
* @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
|
||||||
|
* @property {xl} type = [Number, Object] ≥1920px 响应式栅格数或者栅格属性对象
|
||||||
|
* @description Number时表示在此屏幕宽度下,栅格占据的列数。Object时可配置多个描述{span: 4, offset: 4}
|
||||||
|
*/
|
||||||
|
const ComponentClass = 'uni-col';
|
||||||
|
|
||||||
|
// -1 默认值,因为在微信小程序端只给Number会有默认值0
|
||||||
|
export default {
|
||||||
|
name: 'uniCol',
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
options: {
|
||||||
|
virtualHost: true // 在微信小程序中将组件节点渲染为虚拟节点,更加接近Vue组件的表现
|
||||||
|
},
|
||||||
|
// #endif
|
||||||
|
props: {
|
||||||
|
span: {
|
||||||
|
type: Number,
|
||||||
|
default: 24
|
||||||
|
},
|
||||||
|
offset: {
|
||||||
|
type: Number,
|
||||||
|
default: -1
|
||||||
|
},
|
||||||
|
pull: {
|
||||||
|
type: Number,
|
||||||
|
default: -1
|
||||||
|
},
|
||||||
|
push: {
|
||||||
|
type: Number,
|
||||||
|
default: -1
|
||||||
|
},
|
||||||
|
xs: [Number, Object],
|
||||||
|
sm: [Number, Object],
|
||||||
|
md: [Number, Object],
|
||||||
|
lg: [Number, Object],
|
||||||
|
xl: [Number, Object]
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
gutter: 0,
|
||||||
|
sizeClass: '',
|
||||||
|
parentWidth: 0,
|
||||||
|
nvueWidth: 0,
|
||||||
|
marginLeft: 0,
|
||||||
|
right: 0,
|
||||||
|
left: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
// 字节小程序中,在computed中读取$parent为undefined
|
||||||
|
let parent = this.$parent;
|
||||||
|
|
||||||
|
while (parent && parent.$options.componentName !== 'uniRow') {
|
||||||
|
parent = parent.$parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateGutter(parent.gutter)
|
||||||
|
parent.$watch('gutter', (gutter) => {
|
||||||
|
this.updateGutter(gutter)
|
||||||
|
})
|
||||||
|
|
||||||
|
// #ifdef APP-NVUE
|
||||||
|
this.updateNvueWidth(parent.width)
|
||||||
|
parent.$watch('width', (width) => {
|
||||||
|
this.updateNvueWidth(width)
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
sizeList() {
|
||||||
|
let {
|
||||||
|
span,
|
||||||
|
offset,
|
||||||
|
pull,
|
||||||
|
push
|
||||||
|
} = this;
|
||||||
|
|
||||||
|
return {
|
||||||
|
span,
|
||||||
|
offset,
|
||||||
|
pull,
|
||||||
|
push
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// #ifndef APP-NVUE
|
||||||
|
pointClassList() {
|
||||||
|
let classList = [];
|
||||||
|
|
||||||
|
['xs', 'sm', 'md', 'lg', 'xl'].forEach(point => {
|
||||||
|
const props = this[point];
|
||||||
|
if (typeof props === 'number') {
|
||||||
|
classList.push(`${ComponentClass}-${point}-${props}`)
|
||||||
|
} else if (typeof props === 'object' && props) {
|
||||||
|
Object.keys(props).forEach(pointProp => {
|
||||||
|
classList.push(
|
||||||
|
pointProp === 'span' ?
|
||||||
|
`${ComponentClass}-${point}-${props[pointProp]}` :
|
||||||
|
`${ComponentClass}-${point}-${pointProp}-${props[pointProp]}`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 支付宝小程序使用 :class=[ ['a','b'] ],渲染错误
|
||||||
|
return classList.join(' ');
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
updateGutter(parentGutter) {
|
||||||
|
parentGutter = Number(parentGutter);
|
||||||
|
if (!isNaN(parentGutter)) {
|
||||||
|
this.gutter = parentGutter / 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// #ifdef APP-NVUE
|
||||||
|
updateNvueWidth(width) {
|
||||||
|
// 用于在nvue端,span,offset,pull,push的计算
|
||||||
|
this.parentWidth = width;
|
||||||
|
['span', 'offset', 'pull', 'push'].forEach(size => {
|
||||||
|
const curSize = this[size];
|
||||||
|
if ((curSize || curSize === 0) && curSize !== -1) {
|
||||||
|
let RPX = 1 / 24 * curSize * width
|
||||||
|
RPX = Number(RPX);
|
||||||
|
switch (size) {
|
||||||
|
case 'span':
|
||||||
|
this.nvueWidth = RPX
|
||||||
|
break;
|
||||||
|
case 'offset':
|
||||||
|
this.marginLeft = RPX
|
||||||
|
break;
|
||||||
|
case 'pull':
|
||||||
|
this.right = RPX
|
||||||
|
break;
|
||||||
|
case 'push':
|
||||||
|
this.left = RPX
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
sizeList: {
|
||||||
|
immediate: true,
|
||||||
|
handler(newVal) {
|
||||||
|
// #ifndef APP-NVUE
|
||||||
|
let classList = [];
|
||||||
|
for (let size in newVal) {
|
||||||
|
const curSize = newVal[size];
|
||||||
|
if ((curSize || curSize === 0) && curSize !== -1) {
|
||||||
|
classList.push(
|
||||||
|
size === 'span' ?
|
||||||
|
`${ComponentClass}-${curSize}` :
|
||||||
|
`${ComponentClass}-${size}-${curSize}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 支付宝小程序使用 :class=[ ['a','b'] ],渲染错误
|
||||||
|
this.sizeClass = classList.join(' ');
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-NVUE
|
||||||
|
this.updateNvueWidth(this.parentWidth);
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang='scss' scoped>
|
||||||
|
/* breakpoints */
|
||||||
|
$--sm: 768px !default;
|
||||||
|
$--md: 992px !default;
|
||||||
|
$--lg: 1200px !default;
|
||||||
|
$--xl: 1920px !default;
|
||||||
|
|
||||||
|
$breakpoints: ('xs' : (max-width: $--sm - 1),
|
||||||
|
'sm' : (min-width: $--sm),
|
||||||
|
'md' : (min-width: $--md),
|
||||||
|
'lg' : (min-width: $--lg),
|
||||||
|
'xl' : (min-width: $--xl));
|
||||||
|
|
||||||
|
$layout-namespace: ".uni-";
|
||||||
|
$col: $layout-namespace+"col";
|
||||||
|
|
||||||
|
@function getSize($size) {
|
||||||
|
/* TODO 1/24 * $size * 100 * 1%; 使用计算后的值,为了解决 vue3 控制台报错 */
|
||||||
|
@return 0.04166666666 * $size * 100 * 1%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin res($key, $map:$breakpoints) {
|
||||||
|
@if map-has-key($map, $key) {
|
||||||
|
@media screen and #{inspect(map-get($map,$key))} {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@else {
|
||||||
|
@warn "Undeinfed point: `#{$key}`";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
#{$col} {
|
||||||
|
float: left;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
#{$col}-0 {
|
||||||
|
/* #ifdef APP-NVUE */
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
margin-top: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
margin-left: 0;
|
||||||
|
/* #endif */
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: none;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
@for $i from 0 through 24 {
|
||||||
|
#{$col}-#{$i} {
|
||||||
|
width: getSize($i);
|
||||||
|
}
|
||||||
|
|
||||||
|
#{$col}-offset-#{$i} {
|
||||||
|
margin-left: getSize($i);
|
||||||
|
}
|
||||||
|
|
||||||
|
#{$col}-pull-#{$i} {
|
||||||
|
position: relative;
|
||||||
|
right: getSize($i);
|
||||||
|
}
|
||||||
|
|
||||||
|
#{$col}-push-#{$i} {
|
||||||
|
position: relative;
|
||||||
|
left: getSize($i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@each $point in map-keys($breakpoints) {
|
||||||
|
@include res($point) {
|
||||||
|
#{$col}-#{$point}-0 {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@for $i from 0 through 24 {
|
||||||
|
#{$col}-#{$point}-#{$i} {
|
||||||
|
width: getSize($i);
|
||||||
|
}
|
||||||
|
|
||||||
|
#{$col}-#{$point}-offset-#{$i} {
|
||||||
|
margin-left: getSize($i);
|
||||||
|
}
|
||||||
|
|
||||||
|
#{$col}-#{$point}-pull-#{$i} {
|
||||||
|
position: relative;
|
||||||
|
right: getSize($i);
|
||||||
|
}
|
||||||
|
|
||||||
|
#{$col}-#{$point}-push-#{$i} {
|
||||||
|
position: relative;
|
||||||
|
left: getSize($i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #endif */
|
||||||
|
</style>
|
||||||
190
uni_modules/uni-row/components/uni-row/uni-row.vue
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
<template>
|
||||||
|
<view :class="[ 'uni-row', typeClass , justifyClass, alignClass, ]" :style="{
|
||||||
|
marginLeft:`${Number(marginValue)}rpx`,
|
||||||
|
marginRight:`${Number(marginValue)}rpx`,
|
||||||
|
}">
|
||||||
|
<slot></slot>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const ComponentClass = 'uni-row';
|
||||||
|
const modifierSeparator = '--';
|
||||||
|
/**
|
||||||
|
* Row 布局-行
|
||||||
|
* @description 流式栅格系统,随着屏幕或视口分为 24 份,可以迅速简便地创建布局。
|
||||||
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=3958
|
||||||
|
*
|
||||||
|
* @property {gutter} type = Number 栅格间隔
|
||||||
|
* @property {justify} type = String flex 布局下的水平排列方式
|
||||||
|
* 可选 start/end/center/space-around/space-between start
|
||||||
|
* 默认值 start
|
||||||
|
* @property {align} type = String flex 布局下的垂直排列方式
|
||||||
|
* 可选 top/middle/bottom
|
||||||
|
* 默认值 top
|
||||||
|
* @property {width} type = String|Number nvue下需要自行配置宽度用于计算
|
||||||
|
* 默认值 750
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'uniRow',
|
||||||
|
componentName: 'uniRow',
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
options: {
|
||||||
|
virtualHost: true // 在微信小程序中将组件节点渲染为虚拟节点,更加接近Vue组件的表现,可使用flex布局
|
||||||
|
},
|
||||||
|
// #endif
|
||||||
|
props: {
|
||||||
|
type: String,
|
||||||
|
gutter: Number,
|
||||||
|
justify: {
|
||||||
|
type: String,
|
||||||
|
default: 'start'
|
||||||
|
},
|
||||||
|
align: {
|
||||||
|
type: String,
|
||||||
|
default: 'top'
|
||||||
|
},
|
||||||
|
// nvue如果使用span等属性,需要配置宽度
|
||||||
|
width: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: 750
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
// #ifdef APP-NVUE
|
||||||
|
this.type = 'flex';
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
marginValue() {
|
||||||
|
// #ifndef APP-NVUE
|
||||||
|
if (this.gutter) {
|
||||||
|
return -(this.gutter / 2);
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
return 0;
|
||||||
|
},
|
||||||
|
typeClass() {
|
||||||
|
return this.type === 'flex' ? `${ComponentClass + modifierSeparator}flex` : '';
|
||||||
|
},
|
||||||
|
justifyClass() {
|
||||||
|
return this.justify !== 'start' ? `${ComponentClass + modifierSeparator}flex-justify-${this.justify}` : ''
|
||||||
|
},
|
||||||
|
alignClass() {
|
||||||
|
return this.align !== 'top' ? `${ComponentClass + modifierSeparator}flex-align-${this.align}` : ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
$layout-namespace: ".uni-";
|
||||||
|
$row:$layout-namespace+"row";
|
||||||
|
$modifier-separator: "--";
|
||||||
|
|
||||||
|
@mixin utils-clearfix {
|
||||||
|
$selector: &;
|
||||||
|
|
||||||
|
@at-root {
|
||||||
|
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
#{$selector}::before,
|
||||||
|
#{$selector}::after {
|
||||||
|
display: table;
|
||||||
|
content: "";
|
||||||
|
}
|
||||||
|
|
||||||
|
#{$selector}::after {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin utils-flex ($direction: row) {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
flex-direction: $direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin set-flex($state) {
|
||||||
|
@at-root &-#{$state} {
|
||||||
|
@content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#{$row} {
|
||||||
|
position: relative;
|
||||||
|
flex-direction: row;
|
||||||
|
|
||||||
|
/* #ifdef APP-NVUE */
|
||||||
|
flex: 1;
|
||||||
|
/* #endif */
|
||||||
|
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
box-sizing: border-box;
|
||||||
|
/* #endif */
|
||||||
|
|
||||||
|
// 非nvue使用float布局
|
||||||
|
@include utils-clearfix;
|
||||||
|
|
||||||
|
// 在QQ、字节、百度小程序平台,编译后使用shadow dom,不可使用flex布局,使用float
|
||||||
|
@at-root {
|
||||||
|
|
||||||
|
/* #ifndef MP-QQ || MP-TOUTIAO || MP-BAIDU */
|
||||||
|
&#{$modifier-separator}flex {
|
||||||
|
@include utils-flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
&:before,
|
||||||
|
&:after {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: none;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
@include set-flex(justify-center) {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include set-flex(justify-end) {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include set-flex(justify-space-between) {
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include set-flex(justify-space-around) {
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include set-flex(align-middle) {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include set-flex(align-bottom) {
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 字节、QQ配置后不生效
|
||||||
|
// 此处用法无法使用scoped
|
||||||
|
/* #ifdef MP-WEIXIN || MP-TOUTIAO || MP-QQ */
|
||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #endif */
|
||||||
|
</style>
|
||||||
87
uni_modules/uni-row/package.json
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
{
|
||||||
|
"id": "uni-row",
|
||||||
|
"displayName": "uni-row 布局-行",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "流式栅格系统,随着屏幕或视口分为 24 份,可以迅速简便地创建布局。",
|
||||||
|
"keywords": [
|
||||||
|
"uni-ui",
|
||||||
|
"uniui",
|
||||||
|
"栅格",
|
||||||
|
"布局",
|
||||||
|
"layout"
|
||||||
|
],
|
||||||
|
"repository": "https://github.com/dcloudio/uni-ui",
|
||||||
|
"engines": {
|
||||||
|
"HBuilderX": ""
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"example": "../../temps/example_temps"
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "无",
|
||||||
|
"data": "无",
|
||||||
|
"permissions": "无"
|
||||||
|
},
|
||||||
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": ["uni-scss"],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "y",
|
||||||
|
"aliyun": "y"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"App": {
|
||||||
|
"app-vue": "y",
|
||||||
|
"app-nvue": "y"
|
||||||
|
},
|
||||||
|
"H5-mobile": {
|
||||||
|
"Safari": "y",
|
||||||
|
"Android Browser": "y",
|
||||||
|
"微信浏览器(Android)": "y",
|
||||||
|
"QQ浏览器(Android)": "y"
|
||||||
|
},
|
||||||
|
"H5-pc": {
|
||||||
|
"Chrome": "y",
|
||||||
|
"IE": "y",
|
||||||
|
"Edge": "y",
|
||||||
|
"Firefox": "y",
|
||||||
|
"Safari": "y"
|
||||||
|
},
|
||||||
|
"小程序": {
|
||||||
|
"微信": "y",
|
||||||
|
"阿里": "y",
|
||||||
|
"百度": "y",
|
||||||
|
"字节跳动": "y",
|
||||||
|
"QQ": "y"
|
||||||
|
},
|
||||||
|
"快应用": {
|
||||||
|
"华为": "u",
|
||||||
|
"联盟": "u"
|
||||||
|
},
|
||||||
|
"Vue": {
|
||||||
|
"vue2": "y",
|
||||||
|
"vue3": "u"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
uni_modules/uni-row/readme.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
## Layout 布局
|
||||||
|
|
||||||
|
> **组件名 uni-row、uni-col**
|
||||||
|
> 代码块: `uRow`、`uCol`
|
||||||
|
|
||||||
|
|
||||||
|
流式栅格系统,随着屏幕或视口分为 24 份,可以迅速简便地创建布局。
|
||||||
|
|
||||||
|
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-row)
|
||||||
|
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
|
||||||