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