Comments (2)
我暂时想到的思路如下:
- 实现上面提到的多选功能
- 通过获取选区里面的组件信息(宽高,位置,组件 props 等)保存一份数据对象(重点地方)
- 点击鼠标右键展示是否保存为自定义组件
- 如果数据需要持久化保存,可以把生成新组件数据对象保存在服务器,或者保存在
localStorage
- 系统通过服务器数据动态生成组件
其实加载自定义组件就是把你之前选择的组件通过一个父容器包装一层,父容器里面去渲染你选择的子组件,可以参考containerLayout.vue
这个组件就是一个父容器组件,里面实现了加载子组件功能
伪代码:
// 保存数据结构可以是如下格式
{
key: 'newCustom',
props: {
custom: {name: '自定义组件', icon: '新组件icon图标'},
style: {}, // 新组件样式属性
options: [], // 新组件属性配置对象
// 保存子组件props数据
children: [{
key: 'xaInput',
props: {},// 输入框props属性
... // 其他配置
}]
}
}
// 新组件动态生成模版文件 newCustom.vue
<script>
export default {
name: 'newCustom',
props: {
options: Object // 这个就是上面定义的数据
},
render(h) {
return <div class="xa-newcusotom">
{this.options.children.map(item => {
return <component is={item.key} options={item.props}></component>
})}
</div>
}
}
</script>
from web_designer.
以上方案 是根据目前系统实现方式
之前有考虑上传自定义组件功能, 后面想到需要部署服务器就放弃了,如果系统去实现该功能可以把数据可暂时保存在浏览器本地
from web_designer.
Related Issues (20)
- 模板发布后怎么绑定数据 HOT 1
- 您好,可以问下咱们这个可一次多选几个图形么? HOT 3
- 想请教一下代码发布的思路,烦请大佬解答 HOT 3
- 代码发布,点了没报错,也没 HOT 1
- 在线预览的网址进不去 HOT 1
- 请问怎么样才可以联系到你 HOT 1
- 本地部署,发布成功后,按照命令进行安装npm install,然后进行运行npm run serve就报如下错误,大神可有高招? HOT 1
- 这个发布是什么功能 HOT 3
- 组件 HOT 1
- 代码生成 HOT 1
- 大佬 HOT 1
- 布局问题 HOT 4
- 关于echarts组件问题
- 404 Not Found HOT 2
- 这个icon是哪里实现的,我想加一些icon HOT 1
- 提一个建议 HOT 1
- issues
- 请问是否还会更新呢
- 项目还会更新吗? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web_designer.