提交 ade9e7a5 编写于 作者: M MicroMilo

小队管理基本

上级 4d63b86f
// 表单校验规则由 schema2code 生成,不建议直接修改校验规则,而建议通过 schema2code 生成, 详情: https://uniapp.dcloud.net.cn/uniCloud/schema
const validator = {
"icon": {
"rules": [
{
"format": "string"
}
],
"title": "队标",
"label": "队标"
},
"name": {
"rules": [
{
"format": "string"
}
],
"title": "队名",
"label": "队名"
},
"owner_id": {
"rules": [
{
"format": "string"
}
],
"title": "发起人id",
"label": "发起人id"
},
"description": {
"rules": [
{
"format": "string"
}
],
"title": "描述",
"label": "描述"
}
}
const enumConverter = {}
function filterToWhere(filter, command) {
let where = {}
for (let field in filter) {
let { type, value } = filter[field]
switch (type) {
case "search":
if (typeof value === 'string' && value.length) {
where[field] = new RegExp(value)
}
break;
case "select":
if (value.length) {
let selectValue = []
for (let s of value) {
selectValue.push(command.eq(s))
}
where[field] = command.or(selectValue)
}
break;
case "range":
if (value.length) {
let gt = value[0]
let lt = value[1]
where[field] = command.and([command.gte(gt), command.lte(lt)])
}
break;
case "date":
if (value.length) {
let [s, e] = value
let startDate = new Date(s)
let endDate = new Date(e)
where[field] = command.and([command.gte(startDate), command.lte(endDate)])
}
break;
case "timestamp":
if (value.length) {
let [startDate, endDate] = value
where[field] = command.and([command.gte(startDate), command.lte(endDate)])
}
break;
}
}
return where
}
export { validator, enumConverter, filterToWhere }
...@@ -260,6 +260,21 @@ ...@@ -260,6 +260,21 @@
"style": { "style": {
"navigationBarTitleText": "列表" "navigationBarTitleText": "列表"
} }
}, {
"path": "mustgo-team/add",
"style": {
"navigationBarTitleText": "新增"
}
}, {
"path": "mustgo-team/edit",
"style": {
"navigationBarTitleText": "编辑"
}
}, {
"path": "mustgo-team/list",
"style": {
"navigationBarTitleText": "列表"
}
} }
] ]
}, },
......
<template>
<view class="uni-container">
<uni-forms ref="form" :model="formData" validateTrigger="bind">
<uni-forms-item name="icon" label="队标">
<uni-easyinput placeholder="小队队标" v-model="formData.icon"></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="name" label="队名">
<uni-easyinput placeholder="小队名称" v-model="formData.name"></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="owner_id" label="发起人id">
<uni-easyinput placeholder="小队发起人id" v-model="formData.owner_id"></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="description" label="描述">
<uni-easyinput placeholder="小队描述" v-model="formData.description"></uni-easyinput>
</uni-forms-item>
<view class="uni-button-group">
<button type="primary" class="uni-button" style="width: 100px;" @click="submit">提交</button>
<navigator open-type="navigateBack" style="margin-left: 15px;">
<button class="uni-button" style="width: 100px;">返回</button>
</navigator>
</view>
</uni-forms>
</view>
</template>
<script>
import { validator } from '../../../js_sdk/validator/mustgo-team.js';
const db = uniCloud.database();
const dbCmd = db.command;
const dbCollectionName = 'mustgo-team';
function getValidator(fields) {
let result = {}
for (let key in validator) {
if (fields.includes(key)) {
result[key] = validator[key]
}
}
return result
}
export default {
data() {
let formData = {
"icon": "",
"name": "",
"owner_id": "",
"description": ""
}
return {
formData,
formOptions: {},
rules: {
...getValidator(Object.keys(formData))
}
}
},
onReady() {
this.$refs.form.setRules(this.rules)
},
methods: {
/**
* 验证表单并提交
*/
submit() {
uni.showLoading({
mask: true
})
this.$refs.form.validate().then((res) => {
return this.submitForm(res)
}).catch(() => {
}).finally(() => {
uni.hideLoading()
})
},
/**
* 提交表单
*/
submitForm(value) {
// 使用 clientDB 提交数据
return db.collection(dbCollectionName).add(value).then((res) => {
uni.showToast({
title: '新增成功'
})
this.getOpenerEventChannel().emit('refreshData')
setTimeout(() => uni.navigateBack(), 500)
}).catch((err) => {
uni.showModal({
content: err.message || '请求服务失败',
showCancel: false
})
})
}
}
}
</script>
<template>
<view class="uni-container">
<uni-forms ref="form" :model="formData" validateTrigger="bind">
<uni-forms-item name="icon" label="队标">
<uni-easyinput placeholder="小队队标" v-model="formData.icon"></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="name" label="队名">
<uni-easyinput placeholder="小队名称" v-model="formData.name"></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="owner_id" label="发起人id">
<uni-easyinput placeholder="小队发起人id" v-model="formData.owner_id"></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="description" label="描述">
<uni-easyinput placeholder="小队描述" v-model="formData.description"></uni-easyinput>
</uni-forms-item>
<view class="uni-button-group">
<button type="primary" class="uni-button" style="width: 100px;" @click="submit">提交</button>
<navigator open-type="navigateBack" style="margin-left: 15px;">
<button class="uni-button" style="width: 100px;">返回</button>
</navigator>
</view>
</uni-forms>
</view>
</template>
<script>
import { validator } from '../../../js_sdk/validator/mustgo-team.js';
const db = uniCloud.database();
const dbCmd = db.command;
const dbCollectionName = 'mustgo-team';
function getValidator(fields) {
let result = {}
for (let key in validator) {
if (fields.includes(key)) {
result[key] = validator[key]
}
}
return result
}
export default {
data() {
let formData = {
"icon": "",
"name": "",
"owner_id": "",
"description": ""
}
return {
formData,
formOptions: {},
rules: {
...getValidator(Object.keys(formData))
}
}
},
onLoad(e) {
if (e.id) {
const id = e.id
this.formDataId = id
this.getDetail(id)
}
},
onReady() {
this.$refs.form.setRules(this.rules)
},
methods: {
/**
* 验证表单并提交
*/
submit() {
uni.showLoading({
mask: true
})
this.$refs.form.validate().then((res) => {
return this.submitForm(res)
}).catch(() => {
}).finally(() => {
uni.hideLoading()
})
},
/**
* 提交表单
*/
submitForm(value) {
// 使用 clientDB 提交数据
return db.collection(dbCollectionName).doc(this.formDataId).update(value).then((res) => {
uni.showToast({
title: '修改成功'
})
this.getOpenerEventChannel().emit('refreshData')
setTimeout(() => uni.navigateBack(), 500)
}).catch((err) => {
uni.showModal({
content: err.message || '请求服务失败',
showCancel: false
})
})
},
/**
* 获取表单数据
* @param {Object} id
*/
getDetail(id) {
uni.showLoading({
mask: true
})
db.collection(dbCollectionName).doc(id).field("icon,name,owner_id,description").get().then((res) => {
const data = res.result.data[0]
if (data) {
this.formData = data
}
}).catch((err) => {
uni.showModal({
content: err.message || '请求服务失败',
showCancel: false
})
}).finally(() => {
uni.hideLoading()
})
}
}
}
</script>
<template>
<view>
<view class="uni-header">
<view class="uni-group">
<view class="uni-title"></view>
<view class="uni-sub-title"></view>
</view>
<view class="uni-group">
<input class="uni-search" type="text" v-model="query" @confirm="search" placeholder="请输入搜索内容" />
<button class="uni-button" type="default" size="mini" @click="search">搜索</button>
<button class="uni-button" type="default" size="mini" @click="navigateTo('./add')">新增</button>
<button class="uni-button" type="default" size="mini" :disabled="!selectedIndexs.length" @click="delTable">批量删除</button>
<download-excel class="hide-on-phone" :fields="exportExcel.fields" :data="exportExcelData" :type="exportExcel.type" :name="exportExcel.filename">
<button class="uni-button" type="primary" size="mini">导出 Excel</button>
</download-excel>
</view>
</view>
<view class="uni-container">
<unicloud-db ref="udb" :collection="collectionList" field="icon,name,owner_id,description" :where="where" page-data="replace"
:orderby="orderby" :getcount="true" :page-size="options.pageSize" :page-current="options.pageCurrent"
v-slot:default="{data,pagination,loading,error,options}" :options="options" loadtime="manual" @load="onqueryload">
<uni-table ref="table" :loading="loading" :emptyText="error.message || '没有更多数据'" border stripe type="selection" @selection-change="selectionChange">
<uni-tr>
<uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'icon')" sortable @sort-change="sortChange($event, 'icon')">队标</uni-th>
<uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'name')" sortable @sort-change="sortChange($event, 'name')">队名</uni-th>
<uni-th align="center" sortable @sort-change="sortChange($event, 'owner_id')">发起人id</uni-th>
<uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'description')" sortable @sort-change="sortChange($event, 'description')">描述</uni-th>
<uni-th align="center">操作</uni-th>
</uni-tr>
<uni-tr v-for="(item,index) in data" :key="index">
<uni-td align="center">{{item.icon}}</uni-td>
<uni-td align="center">{{item.name}}</uni-td>
<uni-td align="center">{{item.owner_id}}</uni-td>
<uni-td align="center">{{item.description}}</uni-td>
<uni-td align="center">
<view class="uni-group">
<button @click="navigateTo('./edit?id='+item._id, false)" class="uni-button" size="mini" type="primary">修改</button>
<button @click="confirmDelete(item._id)" class="uni-button" size="mini" type="warn">删除</button>
</view>
</uni-td>
</uni-tr>
</uni-table>
<view class="uni-pagination-box">
<uni-pagination show-icon :page-size="pagination.size" v-model="pagination.current" :total="pagination.count" @change="onPageChanged" />
</view>
</unicloud-db>
</view>
</view>
</template>
<script>
import { enumConverter, filterToWhere } from '../../../js_sdk/validator/mustgo-team.js';
const db = uniCloud.database()
// 表查询配置
const dbOrderBy = '' // 排序字段
const dbSearchFields = [] // 模糊搜索字段,支持模糊搜索的字段列表。联表查询格式: 主表字段名.副表字段名,例如用户表关联角色表 role.role_name
// 分页配置
const pageSize = 20
const pageCurrent = 1
const orderByMapping = {
"ascending": "asc",
"descending": "desc"
}
export default {
data() {
return {
collectionList: "mustgo-team",
query: '',
where: '',
orderby: dbOrderBy,
orderByFieldName: "",
selectedIndexs: [],
options: {
pageSize,
pageCurrent,
filterData: {},
...enumConverter
},
imageStyles: {
width: 64,
height: 64
},
exportExcel: {
"filename": "mustgo-team.xls",
"type": "xls",
"fields": {
"队标": "icon",
"队名": "name",
"发起人id": "owner_id",
"描述": "description"
}
},
exportExcelData: []
}
},
onLoad() {
this._filter = {}
},
onReady() {
this.$refs.udb.loadData()
},
methods: {
onqueryload(data) {
this.exportExcelData = data
},
getWhere() {
const query = this.query.trim()
if (!query) {
return ''
}
const queryRe = new RegExp(query, 'i')
return dbSearchFields.map(name => queryRe + '.test(' + name + ')').join(' || ')
},
search() {
const newWhere = this.getWhere()
this.where = newWhere
this.$nextTick(() => {
this.loadData()
})
},
loadData(clear = true) {
this.$refs.udb.loadData({
clear
})
},
onPageChanged(e) {
this.selectedIndexs.length = 0
this.$refs.table.clearSelection()
this.$refs.udb.loadData({
current: e.current
})
},
navigateTo(url, clear) {
// clear 表示刷新列表时是否清除页码,true 表示刷新并回到列表第 1 页,默认为 true
uni.navigateTo({
url,
events: {
refreshData: () => {
this.loadData(clear)
}
}
})
},
// 多选处理
selectedItems() {
var dataList = this.$refs.udb.dataList
return this.selectedIndexs.map(i => dataList[i]._id)
},
// 批量删除
delTable() {
this.$refs.udb.remove(this.selectedItems(), {
success:(res) => {
this.$refs.table.clearSelection()
}
})
},
// 多选
selectionChange(e) {
this.selectedIndexs = e.detail.index
},
confirmDelete(id) {
this.$refs.udb.remove(id, {
success:(res) => {
this.$refs.table.clearSelection()
}
})
},
sortChange(e, name) {
this.orderByFieldName = name;
if (e.order) {
this.orderby = name + ' ' + orderByMapping[e.order]
} else {
this.orderby = ''
}
this.$refs.table.clearSelection()
this.$nextTick(() => {
this.$refs.udb.loadData()
})
},
filterChange(e, name) {
this._filter[name] = {
type: e.filterType,
value: e.filter
}
let newWhere = filterToWhere(this._filter, db.command)
if (Object.keys(newWhere).length) {
this.where = newWhere
} else {
this.where = ''
}
this.$nextTick(() => {
this.$refs.udb.loadData()
})
}
}
}
</script>
<style>
</style>
...@@ -27,20 +27,20 @@ ...@@ -27,20 +27,20 @@
<uni-tr> <uni-tr>
<uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'name')" <uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'name')"
sortable @sort-change="sortChange($event, 'name')">用户名</uni-th> sortable @sort-change="sortChange($event, 'name')">用户名</uni-th>
<uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'name')" <uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'gender')"
sortable @sort-change="sortChange($event, 'name')">性别</uni-th> sortable @sort-change="sortChange($event, 'gender')">性别</uni-th>
<uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'name')" <uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'password')"
sortable @sort-change="sortChange($event, 'name')">密码</uni-th> sortable @sort-change="sortChange($event, 'password')">密码</uni-th>
<uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'name')" <uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'phone_num')"
sortable @sort-change="sortChange($event, 'name')">手机号</uni-th> sortable @sort-change="sortChange($event, 'phone_num')">手机号</uni-th>
<uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'name')" <uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'school')"
sortable @sort-change="sortChange($event, 'name')">学校</uni-th> sortable @sort-change="sortChange($event, 'school')">学校</uni-th>
<uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'name')" <uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'type[0].identity')"
sortable @sort-change="sortChange($event, 'name')">身份</uni-th> sortable @sort-change="sortChange($event, 'type[0].identity')">身份</uni-th>
<uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'name')" <uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'total_running_distance')"
sortable @sort-change="sortChange($event, 'name')">跑步总量</uni-th> sortable @sort-change="sortChange($event, 'total_running_distance')">跑步总量</uni-th>
<uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'name')" <uni-th align="center" filter-type="search" @filter-change="filterChange($event, 'total_walking_distance')"
sortable @sort-change="sortChange($event, 'name')">健走总量</uni-th> sortable @sort-change="sortChange($event, 'total_walking_distance')">健走总量</uni-th>
<uni-th align="center">操作</uni-th> <uni-th align="center">操作</uni-th>
</uni-tr> </uni-tr>
...@@ -80,40 +80,40 @@ ...@@ -80,40 +80,40 @@
filterToWhere filterToWhere
} from '../../../js_sdk/validator/mustgo-user.js'; } from '../../../js_sdk/validator/mustgo-user.js';
uniCloud.callFunction({ // uniCloud.callFunction({
name: 'fe-sport-walk-rank', // name: 'fe-sport-walk-rank',
data: { // data: {
startTime: "2023-04-28 11:13:54", // startTime: "2023-04-28 11:13:54",
duration: 1000, // duration: 1000,
feelings: "good", // feelings: "good",
userId: "644a643a0c801ca878983559", // userId: "644a643a0c801ca878983559",
distance: 5.98, // distance: 5.98,
pace: 5.1, // pace: 5.1,
startPoint: { // startPoint: {
"longitude": 116.39, // "longitude": 116.39,
"latitude": 39.9 // "latitude": 39.9
}, // },
endPoint: { // endPoint: {
"longitude": 117.9891, // "longitude": 117.9891,
"latitude": 40.98 // "latitude": 40.98
}, // },
pathLine: [{ // pathLine: [{
"longitude": 116.39, // "longitude": 116.39,
"latitude": 39.9 // "latitude": 39.9
}, { // }, {
"longitude": 117.9891, // "longitude": 117.9891,
"latitude": 40.98 // "latitude": 40.98
}] // }]
} // }
}) // })
.then(res => { // .then(res => {
console.log(res); // console.log(res);
}); // });
const db = uniCloud.database() const db = uniCloud.database()
// 表查询配置 // 表查询配置
const dbOrderBy = '' // 排序字段 const dbOrderBy = '' // 排序字段
const dbSearchFields = [] // 模糊搜索字段,支持模糊搜索的字段列表。联表查询格式: 主表字段名.副表字段名,例如用户表关联角色表 role.role_name const dbSearchFields = ['name', '_id', 'phone_num'] // 模糊搜索字段,支持模糊搜索的字段列表。联表查询格式: 主表字段名.副表字段名,例如用户表关联角色表 role.role_name
// 分页配置 // 分页配置
const pageSize = 20 const pageSize = 20
const pageCurrent = 1 const pageCurrent = 1
......
...@@ -12,6 +12,7 @@ exports.main = async (event, context) => { ...@@ -12,6 +12,7 @@ exports.main = async (event, context) => {
let userlist = new Array; let userlist = new Array;
for (let i = 0; i < res.data.length; i++) { for (let i = 0; i < res.data.length; i++) {
let user = { let user = {
"rank": i + 1,
"icon": res.data[i]["icon"], "icon": res.data[i]["icon"],
"username": res.data[i]["name"], "username": res.data[i]["name"],
"distance":res.data[i]["total_running_distance"] "distance":res.data[i]["total_running_distance"]
......
...@@ -12,6 +12,7 @@ exports.main = async (event, context) => { ...@@ -12,6 +12,7 @@ exports.main = async (event, context) => {
let userlist = new Array; let userlist = new Array;
for (let i = 0; i < res.data.length; i++) { for (let i = 0; i < res.data.length; i++) {
let user = { let user = {
"rank": i + 1,
"icon": res.data[i]["icon"], "icon": res.data[i]["icon"],
"username": res.data[i]["name"], "username": res.data[i]["name"],
"distance":res.data[i]["total_walking_distance"] "distance":res.data[i]["total_walking_distance"]
......
{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}} {"bsonType":"object","required":[],"permission":{"read":true,"create":true,"update":true,"delete":true},"properties":{"_id":{"title":"id","description":"ID,系统自动生成"},"id":{"bsonType":"int","title":"活动状态id","description":"活动状态id"},"status":{"bsonType":"string","title":"活动状态","description":"活动状态"}}}
\ No newline at end of file \ No newline at end of file
{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
{"bsonType":"object","required":[],"permission":{"read":true,"create":false,"update":false,"delete":false},"properties":{"_id":{"title":"id","description":"ID,系统自动生成"},"content":{"bsonType":"string","title":"内容","description":"帖子内容"},"date":{"bsonType":"string","title":"发布时间","description":"帖子发布时间"},"likes":{"bsonType":"int","title":"点赞数","description":"帖子点赞数"},"owner_id":{"bsonType":"string","title":"发帖人id","description":"发帖人id","foreignKey":"mustgo-user._id"},"check_status":{"bsonType":"bool","title":"审核状态","description":"帖子审核状态"},"comment_num":{"bsonType":"int","title":"评论数","description":"帖子评论数"},"url":{"bsonType":"array","title":"图片url","description":"帖子中图片url的数组"}}}
\ No newline at end of file
{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}} {"bsonType":"object","required":[],"permission":{"read":true,"create":true,"update":true,"delete":true},"properties":{"_id":{"title":"id","description":"ID,系统自动生成"},"team_activity_id":{"bsonType":"string","foreignKey":"mustgo-team-activity._id","title":"小队活动id","description":"报名信息所属小队活动id"},"owner_id":{"bsonType":"string","foreignKey":"mustgo-user._id","title":"用户id","description":"报名者id"}}}
\ No newline at end of file \ No newline at end of file
{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}} {"bsonType":"object","required":[],"permission":{"read":true,"create":true,"update":true,"delete":true},"properties":{"_id":{"title":"id","description":"ID,系统自动生成"},"identity":{"bsonType":"string","title":"身份","description":"用户身份"}}}
\ No newline at end of file \ No newline at end of file
{ {"bsonType":"object","required":[],"permission":{"read":true,"create":true,"update":true,"delete":true},"properties":{"_id":{"title":"id","description":"ID,系统自动生成"},"start_date":{"bsonType":"string","title":"开始时间","description":"运动开始时间"},"duration":{"bsonType":"int","title":"持续时间","description":"运动持续时间"},"feelings":{"bsonType":"string","title":"感受","description":"运动感受"},"owner_id":{"bsonType":"string","title":"用户id","description":"用户id","foreignKey":"mustgo-user._id"},"distance":{"bsonType":"double","title":"距离","description":"运动距离"},"pace":{"bsonType":"double","title":"配速","description":"运动配速"},"start_point":{"bsonType":"object","title":"起始地点","description":"运动起始地点,经纬度"},"end_point":{"bsonType":"object","title":"结束地点","description":"运动结束地点,经纬度"},"path_line":{"bsonType":"array","title":"路线","description":"运动路线"}}}
"bsonType": "object", \ No newline at end of file
"required": [],
"permission": {
"read": true,
"create": true,
"update": true,
"delete": true
},
"properties": {
"_id": {
"title": "id",
"description": "ID,系统自动生成"
},
"start_date": {
"bsonType": "string",
"title": "开始时间",
"description": "运动开始时间"
},
"duration": {
"bsonType": "int",
"title": "持续时间",
"description": "运动持续时间"
},
"feelings": {
"bsonType": "string",
"title": "感受",
"description": "运动感受"
},
"owner_id": {
"bsonType": "string",
"title": "用户id",
"description": "用户id",
"foreignKey": "mustgo-user._id"
},
"distance": {
"bsonType": "double",
"title": "距离",
"description": "运动距离"
},
"pace": {
"bsonType": "double",
"title": "配速",
"description": "运动配速"
},
"start_point": {
"bsonType": "object",
"title": "起始地点",
"description": "运动起始地点,经纬度"
},
"end_point": {
"bsonType": "object",
"title": "结束地点",
"description": "运动结束地点,经纬度"
},
"path_line": {
"bsonType": "array",
"title": "路线",
"description": "运动路线"
}
}
}
\ No newline at end of file
{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}} {"bsonType":"object","required":[],"permission":{"read":true,"create":true,"update":true,"delete":true},"properties":{"_id":{"title":"id","description":"ID,系统自动生成"},"title":{"bsonType":"string","title":"标题","description":"校园活动标题"},"content":{"bsonType":"string","title":"内容","description":"校园活动内容"},"start_date":{"bsonType":"string","title":"开始时间","description":"校园活动开始时间"},"end_date":{"bsonType":"string","title":"结束时间","description":"校园活动结束时间"},"owner_id":{"bsonType":"string","foreignKey":"mustgo-user._id","title":"发布者id","description":"校园活动发布者id"},"background_picture":{"bsonType":"string","title":"背景图片","description":"校园活动背景图片"},"place":{"bsonType":"string","title":"地点","description":"校园活动地点"},"status":{"bsonType":"int","foreignKey":"mustgo-activity-status.id","title":"活动状态","description":"校园活动状态"},"contact":{"bsonType":"string","title":"联系方式","description":"校园活动发布者联系方式"},"invitee":{"bsonType":"string","title":"面向对象","description":"校园活动面向对象"}}}
\ No newline at end of file \ No newline at end of file
{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}} {"bsonType":"object","required":[],"permission":{"read":true,"create":true,"update":true,"delete":true},"properties":{"_id":{"title":"id","description":"ID,系统自动生成"},"title":{"bsonType":"string","title":"标题","description":"小队活动标题"},"content":{"bsonType":"string","title":"内容","description":"小队活动内容"},"start_date":{"bsonType":"string","title":"开始时间","description":"小队活动开始时间"},"end_date":{"bsonType":"string","title":"结束时间","description":"小队活动结束时间"},"owner_id":{"bsonType":"string","foreignKey":"mustgo-user._id","title":"发布者id","description":"小队活动发布者id"},"background_picture":{"bsonType":"string","title":"背景图片","description":"小队活动背景图片"},"place":{"bsonType":"string","title":"地点","description":"小队活动地点"},"status":{"bsonType":"int","foreignKey":"mustgo-activity-status.id","title":"活动状态","description":"小队活动状态"},"participants":{"bsonType":"int","title":"参与人数","description":"小队活动参与人数"},"contact":{"bsonType":"string","title":"联系方式","description":"小队活动发布者联系方式"},"team_id":{"bsonType":"string","foreignKey":"mustgo-team._id","title":"小队id","description":"活动所属小队id"}}}
\ No newline at end of file \ No newline at end of file
{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}} {"bsonType":"object","required":[],"permission":{"read":true,"create":true,"update":true,"delete":true},"properties":{"_id":{"title":"id","description":"ID,系统自动生成"},"icon":{"bsonType":"string","title":"队标","description":"小队队标"},"name":{"bsonType":"string","title":"队名","description":"小队名称"},"owner_id":{"bsonType":"string","foreignKey":"mustgo-user._id","title":"发起人id","description":"小队发起人id"},"description":{"bsonType":"string","title":"描述","description":"小队描述"}}}
\ No newline at end of file \ No newline at end of file
{ {"bsonType":"object","required":[],"permission":{"read":true,"create":true,"update":true,"delete":true},"properties":{"_id":{"title":"id","description":"ID,系统自动生成"},"name":{"bsonType":"string","title":"姓名","description":"用户姓名"},"icon":{"bsonType":"string","title":"头像","description":"用户头像"},"gender":{"bsonType":"string","title":"性别","description":"用户性别"},"password":{"bsonType":"string","title":"密码","description":"用户密码"},"phone_num":{"bsonType":"string","title":"手机号码","description":"用户手机号码"},"team_id":{"bsonType":"string","defaultValue":"","title":"小队id","description":"用户所属小队id"},"school":{"bsonType":"string","title":"学校","description":"用户所属学校"},"type":{"bsonType":"string","foreignKey":"mustgo-role._id","title":"类型","description":"用户类型"},"total_running_distance":{"bsonType":"double","defaultValue":0,"title":"总跑步距离","description":"用户总跑步距离"},"total_walking_distance":{"bsonType":"double","defaultValue":0,"title":"总健走距离","description":"用户总健走距离"}}}
"bsonType": "object", \ No newline at end of file
"required": [],
"permission": {
"read": true,
"create": true,
"update": true,
"delete": true
},
"properties": {
"_id": {
"title": "id",
"description": "ID,系统自动生成"
},
"name": {
"bsonType": "string",
"title": "姓名",
"description": "用户姓名"
},
"icon": {
"bsonType": "string",
"title": "头像",
"description": "用户头像"
},
"gender": {
"bsonType": "string",
"title": "性别",
"description": "用户性别"
},
"password": {
"bsonType": "string",
"title": "密码",
"description": "用户密码"
},
"phone_num": {
"bsonType": "string",
"title": "手机号码",
"description": "用户手机号码"
},
"team_id": {
"bsonType": "string",
"defaultValue": "",
"title": "小队id",
"description": "用户所属小队id"
},
"school": {
"bsonType": "string",
"title": "学校",
"description": "用户所属学校"
},
"type": {
"bsonType": "string",
"foreignKey": "mustgo-role._id",
"title": "类型",
"description": "用户类型"
},
"total_running_distance": {
"bsonType": "double",
"defaultValue": 0,
"title": "总跑步距离",
"description": "用户总跑步距离"
},
"total_walking_distance": {
"bsonType": "double",
"defaultValue": 0,
"title": "总健走距离",
"description": "用户总健走距离"
}
}
}
\ No newline at end of file
{ {"bsonType":"object","required":[],"permission":{"read":true,"create":true,"update":true,"delete":true},"properties":{"_id":{"title":"id","description":"ID,系统自动生成"},"start_date":{"bsonType":"string","title":"开始时间","description":"运动开始时间"},"duration":{"bsonType":"int","title":"持续时间","description":"运动持续时间"},"feelings":{"bsonType":"string","title":"感受","description":"运动感受"},"owner_id":{"bsonType":"string","title":"用户id","description":"用户id","foreignKey":"mustgo-user._id"},"distance":{"bsonType":"double","title":"距离","description":"运动距离"},"steps":{"bsonType":"int","title":"步数","description":"健走步数"},"start_point":{"bsonType":"object","title":"起始地点","description":"运动起始地点,经纬度"},"end_point":{"bsonType":"object","title":"结束地点","description":"运动结束地点,经纬度"},"path_line":{"bsonType":"array","title":"路线","description":"运动路线"}}}
"bsonType": "object", \ No newline at end of file
"required": [],
"permission": {
"read": true,
"create": true,
"update": true,
"delete": true
},
"properties": {
"_id": {
"title": "id",
"description": "ID,系统自动生成"
},
"start_date": {
"bsonType": "string",
"title": "开始时间",
"description": "运动开始时间"
},
"duration": {
"bsonType": "int",
"title": "持续时间",
"description": "运动持续时间"
},
"feelings": {
"bsonType": "string",
"title": "感受",
"description": "运动感受"
},
"owner_id": {
"bsonType": "string",
"title": "用户id",
"description": "用户id",
"foreignKey": "mustgo-user._id"
},
"distance": {
"bsonType": "double",
"title": "距离",
"description": "运动距离"
},
"steps": {
"bsonType": "int",
"title": "步数",
"description": "健走步数"
},
"start_point": {
"bsonType": "object",
"title": "起始地点",
"description": "运动起始地点,经纬度"
},
"end_point": {
"bsonType": "object",
"title": "结束地点",
"description": "运动结束地点,经纬度"
},
"path_line": {
"bsonType": "array",
"title": "路线",
"description": "运动路线"
}
}
}
\ No newline at end of file
## 1.2.5(2023-03-29)
- 新增 pattern.icon 属性,可自定义图标
## 1.2.4(2022-09-07)
小程序端由于 style 使用了对象导致报错,[详情](https://ask.dcloud.net.cn/question/152790?item_id=211778&rf=false)
## 1.2.3(2022-09-05)
- 修复 nvue 环境下,具有 tabBar 时,fab 组件下部位置无法正常获取 --window-bottom 的bug,详见:[https://ask.dcloud.net.cn/question/110638?notification_id=826310](https://ask.dcloud.net.cn/question/110638?notification_id=826310)
## 1.2.2(2021-12-29)
- 更新 组件依赖
## 1.2.1(2021-11-19)
- 修复 阴影颜色不正确的bug
## 1.2.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-fab](https://uniapp.dcloud.io/component/uniui/uni-fab)
## 1.1.1(2021-11-09)
- 新增 提供组件设计资源,组件样式调整
## 1.1.0(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.7(2021-05-12)
- 新增 组件示例地址
## 1.0.6(2021-02-05)
- 调整为uni_modules目录规范
- 优化 按钮背景色调整
- 优化 兼容pc端
<template>
<view class="uni-cursor-point">
<view v-if="popMenu && (leftBottom||rightBottom||leftTop||rightTop) && content.length > 0" :class="{
'uni-fab--leftBottom': leftBottom,
'uni-fab--rightBottom': rightBottom,
'uni-fab--leftTop': leftTop,
'uni-fab--rightTop': rightTop
}" class="uni-fab"
:style="nvueBottom"
>
<view :class="{
'uni-fab__content--left': horizontal === 'left',
'uni-fab__content--right': horizontal === 'right',
'uni-fab__content--flexDirection': direction === 'vertical',
'uni-fab__content--flexDirectionStart': flexDirectionStart,
'uni-fab__content--flexDirectionEnd': flexDirectionEnd,
'uni-fab__content--other-platform': !isAndroidNvue
}" :style="{ width: boxWidth, height: boxHeight, backgroundColor: styles.backgroundColor }"
class="uni-fab__content" elevation="5">
<view v-if="flexDirectionStart || horizontalLeft" class="uni-fab__item uni-fab__item--first" />
<view v-for="(item, index) in content" :key="index" :class="{ 'uni-fab__item--active': isShow }"
class="uni-fab__item" @click="_onItemClick(index, item)">
<image :src="item.active ? item.selectedIconPath : item.iconPath" class="uni-fab__item-image"
mode="aspectFit" />
<text class="uni-fab__item-text"
:style="{ color: item.active ? styles.selectedColor : styles.color }">{{ item.text }}</text>
</view>
<view v-if="flexDirectionEnd || horizontalRight" class="uni-fab__item uni-fab__item--first" />
</view>
</view>
<view :class="{
'uni-fab__circle--leftBottom': leftBottom,
'uni-fab__circle--rightBottom': rightBottom,
'uni-fab__circle--leftTop': leftTop,
'uni-fab__circle--rightTop': rightTop,
'uni-fab__content--other-platform': !isAndroidNvue
}" class="uni-fab__circle uni-fab__plus" :style="{ 'background-color': styles.buttonColor, 'bottom': nvueBottom }" @click="_onClick">
<uni-icons class="fab-circle-icon" :type="styles.icon" :color="styles.iconColor" size="32"
:class="{'uni-fab__plus--active': isShow && content.length > 0}"></uni-icons>
<!-- <view class="fab-circle-v" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view>
<view class="fab-circle-h" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view> -->
</view>
</view>
</template>
<script>
let platform = 'other'
// #ifdef APP-NVUE
platform = uni.getSystemInfoSync().platform
// #endif
/**
* Fab 悬浮按钮
* @description 点击可展开一个图形按钮菜单
* @tutorial https://ext.dcloud.net.cn/plugin?id=144
* @property {Object} pattern 可选样式配置项
* @property {Object} horizontal = [left | right] 水平对齐方式
* @value left 左对齐
* @value right 右对齐
* @property {Object} vertical = [bottom | top] 垂直对齐方式
* @value bottom 下对齐
* @value top 上对齐
* @property {Object} direction = [horizontal | vertical] 展开菜单显示方式
* @value horizontal 水平显示
* @value vertical 垂直显示
* @property {Array} content 展开菜单内容配置项
* @property {Boolean} popMenu 是否使用弹出菜单
* @event {Function} trigger 展开菜单点击事件,返回点击信息
* @event {Function} fabClick 悬浮按钮点击事件
*/
export default {
name: 'UniFab',
emits: ['fabClick', 'trigger'],
props: {
pattern: {
type: Object,
default () {
return {}
}
},
horizontal: {
type: String,
default: 'left'
},
vertical: {
type: String,
default: 'bottom'
},
direction: {
type: String,
default: 'horizontal'
},
content: {
type: Array,
default () {
return []
}
},
show: {
type: Boolean,
default: false
},
popMenu: {
type: Boolean,
default: true
}
},
data() {
return {
fabShow: false,
isShow: false,
isAndroidNvue: platform === 'android',
styles: {
color: '#3c3e49',
selectedColor: '#007AFF',
backgroundColor: '#fff',
buttonColor: '#007AFF',
iconColor: '#fff',
icon: 'plusempty'
}
}
},
computed: {
contentWidth(e) {
return (this.content.length + 1) * 55 + 15 + 'px'
},
contentWidthMin() {
return '55px'
},
// 动态计算宽度
boxWidth() {
return this.getPosition(3, 'horizontal')
},
// 动态计算高度
boxHeight() {
return this.getPosition(3, 'vertical')
},
// 计算左下位置
leftBottom() {
return this.getPosition(0, 'left', 'bottom')
},
// 计算右下位置
rightBottom() {
return this.getPosition(0, 'right', 'bottom')
},
// 计算左上位置
leftTop() {
return this.getPosition(0, 'left', 'top')
},
rightTop() {
return this.getPosition(0, 'right', 'top')
},
flexDirectionStart() {
return this.getPosition(1, 'vertical', 'top')
},
flexDirectionEnd() {
return this.getPosition(1, 'vertical', 'bottom')
},
horizontalLeft() {
return this.getPosition(2, 'horizontal', 'left')
},
horizontalRight() {
return this.getPosition(2, 'horizontal', 'right')
},
// 计算 nvue bottom
nvueBottom() {
const safeBottom = uni.getSystemInfoSync().windowBottom;
// #ifdef APP-NVUE
return 30 + safeBottom
// #endif
// #ifndef APP-NVUE
return 30
// #endif
}
},
watch: {
pattern: {
handler(val, oldVal) {
this.styles = Object.assign({}, this.styles, val)
},
deep: true
}
},
created() {
this.isShow = this.show
if (this.top === 0) {
this.fabShow = true
}
// 初始化样式
this.styles = Object.assign({}, this.styles, this.pattern)
},
methods: {
_onClick() {
this.$emit('fabClick')
if (!this.popMenu) {
return
}
this.isShow = !this.isShow
},
open() {
this.isShow = true
},
close() {
this.isShow = false
},
/**
* 按钮点击事件
*/
_onItemClick(index, item) {
if (!this.isShow) {
return
}
this.$emit('trigger', {
index,
item
})
},
/**
* 获取 位置信息
*/
getPosition(types, paramA, paramB) {
if (types === 0) {
return this.horizontal === paramA && this.vertical === paramB
} else if (types === 1) {
return this.direction === paramA && this.vertical === paramB
} else if (types === 2) {
return this.direction === paramA && this.horizontal === paramB
} else {
return this.isShow && this.direction === paramA ? this.contentWidth : this.contentWidthMin
}
}
}
}
</script>
<style lang="scss" >
$uni-shadow-base:0 1px 5px 2px rgba($color: #000000, $alpha: 0.3) !default;
.uni-fab {
position: fixed;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
z-index: 10;
border-radius: 45px;
box-shadow: $uni-shadow-base;
}
.uni-cursor-point {
/* #ifdef H5 */
cursor: pointer;
/* #endif */
}
.uni-fab--active {
opacity: 1;
}
.uni-fab--leftBottom {
left: 15px;
bottom: 30px;
/* #ifdef H5 */
left: calc(15px + var(--window-left));
bottom: calc(30px + var(--window-bottom));
/* #endif */
// padding: 10px;
}
.uni-fab--leftTop {
left: 15px;
top: 30px;
/* #ifdef H5 */
left: calc(15px + var(--window-left));
top: calc(30px + var(--window-top));
/* #endif */
// padding: 10px;
}
.uni-fab--rightBottom {
right: 15px;
bottom: 30px;
/* #ifdef H5 */
right: calc(15px + var(--window-right));
bottom: calc(30px + var(--window-bottom));
/* #endif */
// padding: 10px;
}
.uni-fab--rightTop {
right: 15px;
top: 30px;
/* #ifdef H5 */
right: calc(15px + var(--window-right));
top: calc(30px + var(--window-top));
/* #endif */
// padding: 10px;
}
.uni-fab__circle {
position: fixed;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
width: 55px;
height: 55px;
background-color: #3c3e49;
border-radius: 45px;
z-index: 11;
// box-shadow: $uni-shadow-base;
}
.uni-fab__circle--leftBottom {
left: 15px;
bottom: 30px;
/* #ifdef H5 */
left: calc(15px + var(--window-left));
bottom: calc(30px + var(--window-bottom));
/* #endif */
}
.uni-fab__circle--leftTop {
left: 15px;
top: 30px;
/* #ifdef H5 */
left: calc(15px + var(--window-left));
top: calc(30px + var(--window-top));
/* #endif */
}
.uni-fab__circle--rightBottom {
right: 15px;
bottom: 30px;
/* #ifdef H5 */
right: calc(15px + var(--window-right));
bottom: calc(30px + var(--window-bottom));
/* #endif */
}
.uni-fab__circle--rightTop {
right: 15px;
top: 30px;
/* #ifdef H5 */
right: calc(15px + var(--window-right));
top: calc(30px + var(--window-top));
/* #endif */
}
.uni-fab__circle--left {
left: 0;
}
.uni-fab__circle--right {
right: 0;
}
.uni-fab__circle--top {
top: 0;
}
.uni-fab__circle--bottom {
bottom: 0;
}
.uni-fab__plus {
font-weight: bold;
}
// .fab-circle-v {
// position: absolute;
// width: 2px;
// height: 24px;
// left: 0;
// top: 0;
// right: 0;
// bottom: 0;
// /* #ifndef APP-NVUE */
// margin: auto;
// /* #endif */
// background-color: white;
// transform: rotate(0deg);
// transition: transform 0.3s;
// }
// .fab-circle-h {
// position: absolute;
// width: 24px;
// height: 2px;
// left: 0;
// top: 0;
// right: 0;
// bottom: 0;
// /* #ifndef APP-NVUE */
// margin: auto;
// /* #endif */
// background-color: white;
// transform: rotate(0deg);
// transition: transform 0.3s;
// }
.fab-circle-icon {
transform: rotate(0deg);
transition: transform 0.3s;
font-weight: 200;
}
.uni-fab__plus--active {
transform: rotate(135deg);
}
.uni-fab__content {
/* #ifndef APP-NVUE */
box-sizing: border-box;
display: flex;
/* #endif */
flex-direction: row;
border-radius: 55px;
overflow: hidden;
transition-property: width, height;
transition-duration: 0.2s;
width: 55px;
border-color: #DDDDDD;
border-width: 1rpx;
border-style: solid;
}
.uni-fab__content--other-platform {
border-width: 0px;
box-shadow: $uni-shadow-base;
}
.uni-fab__content--left {
justify-content: flex-start;
}
.uni-fab__content--right {
justify-content: flex-end;
}
.uni-fab__content--flexDirection {
flex-direction: column;
justify-content: flex-end;
}
.uni-fab__content--flexDirectionStart {
flex-direction: column;
justify-content: flex-start;
}
.uni-fab__content--flexDirectionEnd {
flex-direction: column;
justify-content: flex-end;
}
.uni-fab__item {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
width: 55px;
height: 55px;
opacity: 0;
transition: opacity 0.2s;
}
.uni-fab__item--active {
opacity: 1;
}
.uni-fab__item-image {
width: 20px;
height: 20px;
margin-bottom: 4px;
}
.uni-fab__item-text {
color: #FFFFFF;
font-size: 12px;
line-height: 12px;
margin-top: 2px;
}
.uni-fab__item--first {
width: 55px;
}
</style>
{
"id": "uni-fab",
"displayName": "uni-fab 悬浮按钮",
"version": "1.2.5",
"description": "悬浮按钮 fab button ,点击可展开一个图标按钮菜单。",
"keywords": [
"uni-ui",
"uniui",
"按钮",
"悬浮按钮",
"fab"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
},
"uni_modules": {
"dependencies": ["uni-scss","uni-icons"],
"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": "y"
}
}
}
}
}
## Fab 悬浮按钮
> **组件名:uni-fab**
> 代码块: `uFab`
点击可展开一个图形按钮菜单
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-fab)
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
\ No newline at end of file
## 1.2.14(2023-04-14)
- 优化 uni-list-chat 具名插槽`header` 非app端套一层元素,方便使用时通过外层元素定位实现样式修改
## 1.2.13(2023-03-03)
- uni-list-chat 新增 支持具名插槽`header`
## 1.2.12(2023-02-01) ## 1.2.12(2023-02-01)
- 新增 列表图标新增 customPrefix 属性 ,用法 [详见](https://uniapp.dcloud.net.cn/component/uniui/uni-icons.html#icons-props) - 新增 列表图标新增 customPrefix 属性 ,用法 [详见](https://uniapp.dcloud.net.cn/component/uniui/uni-icons.html#icons-props)
## 1.2.11(2023-01-31) ## 1.2.11(2023-01-31)
......
...@@ -18,6 +18,13 @@ ...@@ -18,6 +18,13 @@
</view> </view>
</view> </view>
</view> </view>
<!-- #ifndef APP -->
<view class="slot-header">
<!-- #endif -->
<slot name="header"></slot>
<!-- #ifndef APP -->
</view>
<!-- #endif -->
<view v-if="badgeText && badgePositon === 'left'" class="uni-list-chat__badge uni-list-chat__badge-pos" :class="[isSingle]"> <view v-if="badgeText && badgePositon === 'left'" class="uni-list-chat__badge uni-list-chat__badge-pos" :class="[isSingle]">
<text class="uni-list-chat__badge-text">{{ badgeText === 'dot' ? '' : badgeText }}</text> <text class="uni-list-chat__badge-text">{{ badgeText === 'dot' ? '' : badgeText }}</text>
</view> </view>
......
...@@ -198,26 +198,29 @@ ...@@ -198,26 +198,29 @@
} }
let paddingArr = padding.split(' ') let paddingArr = padding.split(' ')
if (paddingArr.length === 1) { if (paddingArr.length === 1) {
const allPadding = paddingArr[0]
this.padding = { this.padding = {
"top": padding, "top": allPadding,
"right": padding, "right": allPadding,
"bottom": padding, "bottom": allPadding,
"left": padding "left": allPadding
} }
} else if (paddingArr.length === 2) { } else if (paddingArr.length === 2) {
const [verticalPadding, horizontalPadding] = paddingArr;
this.padding = { this.padding = {
"top": padding[0], "top": verticalPadding,
"right": padding[1], "right": horizontalPadding,
"bottom": padding[0], "bottom": verticalPadding,
"left": padding[1] "left": horizontalPadding
} }
} else if (paddingArr.length === 4) { } else if (paddingArr.length === 4) {
this.padding = { const [topPadding, rightPadding, bottomPadding, leftPadding] = paddingArr;
"top": padding[0], this.padding = {
"right": padding[1], "top": topPadding,
"bottom": padding[2], "right": rightPadding,
"left": padding[3] "bottom": bottomPadding,
} "left": leftPadding
}
} }
}, },
immediate: true immediate: true
......
{ {
"id": "uni-list", "id": "uni-list",
"displayName": "uni-list 列表", "displayName": "uni-list 列表",
"version": "1.2.12", "version": "1.2.14",
"description": "List 组件 ,帮助使用者快速构建列表。", "description": "List 组件 ,帮助使用者快速构建列表。",
"keywords": [ "keywords": [
"", "",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册