提交 935d6cba 作者: 方治民

style: 代码格式调整

上级 f594f7fd
......@@ -2,6 +2,7 @@
import { getData } from './data'
interface Params {
title?: string
multiple?: boolean
}
......@@ -10,7 +11,7 @@
search: '',
data: [] as Recordable[],
show: false,
permissions: [],
buttons: [],
})
const data = computed(() => {
......@@ -32,22 +33,24 @@
}
})
const permissionButtonWidth = computed(() => {
const len = model.permissions.length
return (750 - 60) / len - (len - 1) * (30 / len)
})
onLoad(({ multiple }) => {
onLoad(({ multiple, title }) => {
model.params.title = title
model.params.multiple = multiple === 'true'
// 自定义设置标题
if (title) {
uni.setNavigationBarTitle({ title })
}
// 获取人员列表
Message.loading('加载中...')
model.data = getData()
Message.hideLoading()
model.permissions = []
// 操作项
model.buttons = []
if (model.params.multiple) {
model.permissions.push({
model.buttons.push({
name: '确定',
value: 'SUBMIT',
type: 'primary',
......@@ -80,6 +83,11 @@
uni.$emit('chooseShootOrderReceiverUser', result)
uni.navigateBack()
}
const buttonWidth = computed(() => {
const len = model.buttons.length
return (750 - 60) / len - (len - 1) * (30 / len)
})
</script>
<template>
......@@ -111,13 +119,13 @@
<!-- 操作按钮 -->
<view class="opts-wrap">
<fui-button
v-for="opt in model.permissions"
v-for="opt in model.buttons"
:key="opt.value"
@tap="opt.onClick"
:text="opt.name"
:type="opt.type"
radius="96rpx"
:width="`${permissionButtonWidth}rpx`"
:width="`${buttonWidth}rpx`"
height="96rpx"
/>
</view>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论