mirror of
https://gitee.com/was666/as-editor.git
synced 2025-02-23 10:42:48 +08:00
feat: 新增 固定位置的组件(如: 底部导航、悬浮)不能放在第一个
This commit is contained in:
parent
6de4dfd4e1
commit
d9697212df
@ -396,6 +396,21 @@ export default {
|
||||
componentProperties.get(event.dataTransfer.getData('componentName'))
|
||||
)
|
||||
|
||||
/* 查询是否只能存在一个的组件且在第一个 */
|
||||
let someOne = this.pageComponents.some((item, index) => {
|
||||
return (
|
||||
item.component === 'placementarea' &&
|
||||
index === 0 &&
|
||||
this.onlyOne.includes(data.type)
|
||||
)
|
||||
})
|
||||
if (someOne) {
|
||||
this.$message.info('固定位置的组件(如: 底部导航、悬浮)不能放在第一个!')
|
||||
/* 删除提示组件 */
|
||||
this.dragleaves()
|
||||
return
|
||||
}
|
||||
|
||||
/* 查询是否只能存在一个的组件 */
|
||||
let someResult = this.pageComponents.some((item) => {
|
||||
return (
|
||||
@ -406,9 +421,7 @@ export default {
|
||||
if (someResult) {
|
||||
this.$message.info('当前组件只能添加一个!')
|
||||
/* 删除提示组件 */
|
||||
this.pageComponents = this.pageComponents.filter(
|
||||
(res) => res.component !== 'placementarea'
|
||||
)
|
||||
this.dragleaves()
|
||||
return
|
||||
}
|
||||
|
||||
@ -420,11 +433,6 @@ export default {
|
||||
this.index = index
|
||||
if (res.component === 'placementarea')
|
||||
this.$set(this.pageComponents, index, data)
|
||||
|
||||
if (this.pageComponents.length === index + 1)
|
||||
this.pageComponents = this.pageComponents.filter(
|
||||
(res) => res.component !== 'placementarea'
|
||||
)
|
||||
})
|
||||
|
||||
/* 切换组件 */
|
||||
|
Loading…
Reference in New Issue
Block a user