Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
edfdee8c
authored
Dec 09, 2023
by
owen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
营销:适配商城装修组件【悬浮按钮】
parent
76025b68
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
163 additions
and
1 deletions
+163
-1
src/components/DiyEditor/components/mobile/FloatingActionButton/config.ts
+36
-0
src/components/DiyEditor/components/mobile/FloatingActionButton/index.vue
+74
-0
src/components/DiyEditor/components/mobile/FloatingActionButton/property.vue
+44
-0
src/components/DiyEditor/util.ts
+9
-1
No files found.
src/components/DiyEditor/components/mobile/FloatingActionButton/config.ts
0 → 100644
View file @
edfdee8c
import
{
DiyComponent
}
from
'@/components/DiyEditor/util'
// 悬浮按钮属性
export
interface
FloatingActionButtonProperty
{
// 展开方向
direction
:
'horizontal'
|
'vertical'
// 是否显示文字
showText
:
boolean
// 按钮列表
list
:
FloatingActionButtonItemProperty
[]
}
// 悬浮按钮项属性
export
interface
FloatingActionButtonItemProperty
{
// 图片地址
imgUrl
:
string
// 跳转连接
url
:
string
// 文字
text
:
string
// 文字颜色
textColor
:
string
}
// 定义组件
export
const
component
=
{
id
:
'FloatingActionButton'
,
name
:
'悬浮按钮'
,
icon
:
'tabler:float-right'
,
position
:
'fixed'
,
property
:
{
direction
:
'vertical'
,
showText
:
true
,
list
:
[{
textColor
:
'#fff'
}]
}
}
as
DiyComponent
<
FloatingActionButtonProperty
>
src/components/DiyEditor/components/mobile/FloatingActionButton/index.vue
0 → 100644
View file @
edfdee8c
<
template
>
<div
:class=
"[
'absolute bottom-32px right-[calc(50%-375px/2+32px)] flex z-12 gap-12px items-center',
{
'flex-row': property.direction === 'horizontal',
'flex-col': property.direction === 'vertical'
}
]"
>
<template
v-if=
"expanded"
>
<div
v-for=
"(item, index) in property.list"
:key=
"index"
class=
"flex flex-col items-center"
@
click=
"handleActive(index)"
>
<el-image
:src=
"item.imgUrl"
fit=
"contain"
class=
"h-27px w-27px"
>
<template
#
error
>
<div
class=
"h-full w-full flex items-center justify-center"
>
<Icon
icon=
"ep:picture"
:color=
"item.textColor"
/>
</div>
</
template
>
</el-image>
<span
v-if=
"property.showText"
class=
"mt-4px text-12px"
:style=
"{ color: item.textColor }"
>
{{ item.text }}
</span>
</div>
</template>
<!-- todo: @owen 使用APP主题色 -->
<el-button
type=
"primary"
size=
"large"
circle
@
click=
"handleToggleFab"
>
<Icon
icon=
"ep:plus"
:class=
"['fab-icon', { active: expanded }]"
/>
</el-button>
</div>
<!-- 模态背景:展开时显示,点击后折叠 -->
<div
v-if=
"expanded"
class=
"modal-bg"
@
click=
"handleToggleFab"
></div>
</template>
<
script
setup
lang=
"ts"
>
import
{
FloatingActionButtonProperty
}
from
'./config'
/** 悬浮按钮 */
defineOptions
({
name
:
'FloatingActionButton'
})
// 定义属性
defineProps
<
{
property
:
FloatingActionButtonProperty
}
>
()
// 是否展开
const
expanded
=
ref
(
true
)
// 处理展开/折叠
const
handleToggleFab
=
()
=>
{
expanded
.
value
=
!
expanded
.
value
}
</
script
>
<
style
scoped
lang=
"scss"
>
/* 模态背景 */
.modal-bg
{
position
:
absolute
;
left
:
calc
(
50%
-
375px
/
2
);
top
:
0
;
z-index
:
11
;
width
:
375px
;
height
:
100%
;
background-color
:
rgba
(
#000000
,
0.4
);
}
.fab-icon
{
transform
:
rotate
(
0deg
);
transition
:
transform
0.3s
;
&.active
{
transform
:
rotate
(
135deg
);
}
}
</
style
>
src/components/DiyEditor/components/mobile/FloatingActionButton/property.vue
0 → 100644
View file @
edfdee8c
<
template
>
<el-form
label-width=
"80px"
:model=
"formData"
>
<el-card
header=
"按钮配置"
class=
"property-group"
shadow=
"never"
>
<el-form-item
label=
"展开方向"
prop=
"direction"
>
<el-radio-group
v-model=
"formData.direction"
>
<el-radio
label=
"vertical"
>
垂直
</el-radio>
<el-radio
label=
"horizontal"
>
水平
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"显示文字"
prop=
"showText"
>
<el-switch
v-model=
"formData.showText"
/>
</el-form-item>
</el-card>
<el-card
header=
"按钮列表"
class=
"property-group"
shadow=
"never"
>
<Draggable
v-model=
"formData.list"
:empty-item=
"
{ textColor: '#fff' }">
<template
#
default=
"
{ element, index }">
<el-form-item
label=
"图标"
:prop=
"`list[$
{index}].imgUrl`">
<UploadImg
v-model=
"element.imgUrl"
height=
"56px"
width=
"56px"
/>
</el-form-item>
<el-form-item
label=
"文字"
:prop=
"`list[$
{index}].text`">
<InputWithColor
v-model=
"element.text"
v-model:color=
"element.textColor"
/>
</el-form-item>
<el-form-item
label=
"跳转链接"
:prop=
"`list[$
{index}].url`">
<AppLinkInput
v-model=
"element.url"
/>
</el-form-item>
</
template
>
</Draggable>
</el-card>
</el-form>
</template>
<
script
setup
lang=
"ts"
>
import
{
FloatingActionButtonProperty
}
from
'./config'
import
{
usePropertyForm
}
from
'@/components/DiyEditor/util'
// 悬浮按钮属性面板
defineOptions
({
name
:
'FloatingActionButtonProperty'
})
const
props
=
defineProps
<
{
modelValue
:
FloatingActionButtonProperty
}
>
()
const
emit
=
defineEmits
([
'update:modelValue'
])
const
{
formData
}
=
usePropertyForm
(
props
.
modelValue
,
emit
)
</
script
>
<
style
scoped
lang=
"scss"
></
style
>
src/components/DiyEditor/util.ts
View file @
edfdee8c
...
...
@@ -111,7 +111,15 @@ export const PAGE_LIBS = [
{
name
:
'基础组件'
,
extended
:
true
,
components
:
[
'SearchBar'
,
'NoticeBar'
,
'MenuSwiper'
,
'MenuGrid'
,
'MenuList'
,
'Popover'
]
components
:
[
'SearchBar'
,
'NoticeBar'
,
'MenuSwiper'
,
'MenuGrid'
,
'MenuList'
,
'Popover'
,
'FloatingActionButton'
]
},
{
name
:
'图文组件'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment