Skip to content

Commit

Permalink
还是代码生成吧
Browse files Browse the repository at this point in the history
  • Loading branch information
sunzhengjie committed Nov 19, 2017
1 parent 8c89212 commit 8003565
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 14 deletions.
2 changes: 2 additions & 0 deletions ui/src/core/dnd.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,14 @@ function markDrop(drop, mark) {
function interceptDrop(saveInfo) {
if (saveInfo.drag.type === 'WrapCard') {
let dropPanelSoul = findSoulByCid(100, store.getters['dragModule/draggableControls'])

let copy = deepCopy(dropPanelSoul)
copy.slotName = 'title'
copy.uid = generateUid()
saveInfo.drag.children.push(copy)
copy = deepCopy(dropPanelSoul)
copy.slotName = 'extra'

copy.uid = generateUid()
saveInfo.drag.children.push(copy)
copy = deepCopy(dropPanelSoul)
Expand Down
21 changes: 12 additions & 9 deletions ui/src/helper/code_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ function getVueHtml(soul,data) {
slotName='',
innerHTML = ''

if(soul.slotName){
//is a slot of parent
if(!soul.showSlot){
return ''
}

slotName = 'slot="'+soul.slotName+'"'
}

for (let key in model) {

let propStr,
Expand Down Expand Up @@ -53,14 +62,6 @@ function getVueHtml(soul,data) {
//don't need compile this model value
propStr = ''

}else if(soul.slotName){
//is a slot of parent
if(!soul.showSlot){
return ''
}

slotName = 'slot="'+soul.slotName+'"'

}else if(soul.type ==='Icon'){
//is Icon
prop[key] = model[key].value + ''
Expand All @@ -79,7 +80,9 @@ function getVueHtml(soul,data) {
innerHTML+=model[key].value

}else {
if (model[key].type === 'json') {
if (model[key].ignore){
props =''
}else if (model[key].type === 'json') {
//model value is object
prop[key] = model[key].value
propStr = prop[key] = JSON.stringify(prop)
Expand Down
35 changes: 30 additions & 5 deletions ui/src/view/esview/render.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,51 @@
<Div>
<Form labelWidth="100">
<Row type="flex">
<Col span="12">
<FormItem label="label">
<Col span="10">
<FormItem label="input">
<Input v-model="modelInput">
</Input>
</FormItem>
<FormItem label="label">
<FormItem label="number">
<InputNumber v-model="modelInput" max="10" min="0">
</InputNumber>
</FormItem>
<FormItem label="date">
<DatePicker v-model="modelDatePicker" type="date" format="yyyy-MM-dd HH:mm:ss">
</DatePicker>
</FormItem>
<FormItem>
<Button type="primary">提交</Button>
</FormItem>
</Col>
</Row>
</Form>
<Table></Table>
<Page current="1" pageSize="10" total="100"></Page>
<Row type="flex">
<Col span="24">
<Tabs>
<TabPane label="tab1">
<Table></Table>
<Row type="flex">
<Col span="10"> </Col>
<Col span="14">
<Page current="1" pageSize="10" total="100"></Page>
</Col>
</Row>
</TabPane>
<TabPane label="tab2">
<Table></Table>
</TabPane>
</Tabs>
</Col>
</Row>
</Div>
</template>
<script>
export default {
data() {
return {
"modelInput": "",
"modelDatePicker": "",
"columns": [{
"title": "Name",
"key": "name"
Expand Down

0 comments on commit 8003565

Please sign in to comment.