mirror of
https://gitee.com/was666/as-editor.git
synced 2026-01-29 00:02:43 +08:00
feat: 新增某些组件只能存在一个的配置(例: 底部导航)
This commit is contained in:
@@ -63,7 +63,7 @@
|
|||||||
|
|
||||||
<!-- 上传图片 -->
|
<!-- 上传图片 -->
|
||||||
<el-button @click="showUpload('0')" class="uploadImg" type="primary" plain
|
<el-button @click="showUpload('0')" class="uploadImg" type="primary" plain
|
||||||
><i class="el-icon-plus" />点击添加图片</el-button
|
><i class="el-icon-plus" />点击添加导航</el-button
|
||||||
>
|
>
|
||||||
|
|
||||||
<div class="bor"></div>
|
<div class="bor"></div>
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ export default {
|
|||||||
pageComponents: [], //页面组件
|
pageComponents: [], //页面组件
|
||||||
offsetY: 0, //记录上一次距离父元素高度
|
offsetY: 0, //记录上一次距离父元素高度
|
||||||
pointer: { show: false }, //穿透
|
pointer: { show: false }, //穿透
|
||||||
onlyOne: ['1-21', '1-22'], // 只能存在一个的组件
|
onlyOne: ['1-5','1-16'], // 只能存在一个的组件(组件的type)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -392,15 +392,15 @@ export default {
|
|||||||
*/
|
*/
|
||||||
drop(event) {
|
drop(event) {
|
||||||
/* 获取数据 */
|
/* 获取数据 */
|
||||||
|
|
||||||
let data = utils.deepClone(
|
let data = utils.deepClone(
|
||||||
componentProperties.get(event.dataTransfer.getData('componentName'))
|
componentProperties.get(event.dataTransfer.getData('componentName'))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/* 查询是否只能存在一个的组件 */
|
||||||
let someResult = this.pageComponents.some((item) => {
|
let someResult = this.pageComponents.some((item) => {
|
||||||
return (
|
return (
|
||||||
this.onlyOne.includes(item.type) &&
|
this.onlyOne.includes(item.type) &&
|
||||||
item.type === event.dataTransfer.getData('Text')
|
item.component === event.dataTransfer.getData('componentName')
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
if (someResult) {
|
if (someResult) {
|
||||||
|
|||||||
Reference in New Issue
Block a user