mirror of
https://github.com/vxcontrol/ncform.git
synced 2026-07-19 18:23:32 -04:00
159 lines
4.2 KiB
JavaScript
159 lines
4.2 KiB
JavaScript
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title>object widget</title>
|
|
|
|
<link rel="stylesheet" href="../demo.css" />
|
|
|
|
<!-- 引入样式 -->
|
|
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css" />
|
|
</head>
|
|
|
|
<body>
|
|
<!--演示区域-->
|
|
<div id="demo" v-cloak>
|
|
<div v-for="(item, idx) in formSchemas">
|
|
<h4 class="demo_title">{{ item.title }}</h4>
|
|
<div class="demo_item-wrapper">
|
|
<div>
|
|
<ncform :form-schema="item.schema" v-model="item.schema.value"></ncform>
|
|
<small>value: {{ item.schema.value }}</small>
|
|
</div>
|
|
<div>
|
|
<pre>{{ JSON.stringify(originFormSchemas[idx].schema.properties, null, 2) }}</pre>
|
|
</div>
|
|
<div>
|
|
<pre>{{ item.detail }}</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript" src="../../node_modules/lodash/lodash.min.js"></script>
|
|
<script type="text/javascript" src="https://unpkg.com/vue@2.6.11/dist/vue.min.js"></script>
|
|
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"></script>
|
|
<script type="text/javascript" src="../../node_modules/@vxcontrol/ncform-common/dist/ncformCommon.js"></script>
|
|
<script type="text/javascript" src="../../node_modules/@vxcontrol/ncform/dist/vueNcform.min.js"></script>
|
|
<script type="text/javascript" src="../../dist/input.js"></script>
|
|
<script type="text/javascript" src="../../dist/object.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
Vue.use(vueNcform, { extComponents: { input: input.default, object: object.default } });
|
|
|
|
let formSchemas = [
|
|
{
|
|
title: 'Default state',
|
|
schema: {
|
|
type: 'object',
|
|
properties: {
|
|
user: {
|
|
type: 'object',
|
|
properties: {
|
|
name: {
|
|
type: 'string'
|
|
}
|
|
},
|
|
ui: {
|
|
label: 'haha',
|
|
legend: 'HAHa'
|
|
}
|
|
},
|
|
},
|
|
ui: {
|
|
widgetConfig: {
|
|
layout: 'h'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
title: 'Default state 1',
|
|
schema: {
|
|
type: 'object',
|
|
properties: {
|
|
user: {
|
|
type: 'object',
|
|
properties: {
|
|
name: {
|
|
type: 'string'
|
|
}
|
|
},
|
|
ui: {
|
|
label: 'haha',
|
|
legend: 'HAHa'
|
|
}
|
|
},
|
|
},
|
|
ui: {
|
|
widgetConfig: {
|
|
layout: 'v'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
title: 'Default state 2',
|
|
schema: {
|
|
type: 'object',
|
|
properties: {
|
|
user: {
|
|
type: 'object',
|
|
properties: {
|
|
name: {
|
|
type: 'string'
|
|
}
|
|
},
|
|
ui: {
|
|
label: 'haha',
|
|
showLegend: false
|
|
}
|
|
},
|
|
},
|
|
ui: {
|
|
widgetConfig: {
|
|
layout: 'v'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
title: 'Default state 2',
|
|
schema: {
|
|
type: 'object',
|
|
properties: {
|
|
user: {
|
|
type: 'object',
|
|
properties: {
|
|
name: {
|
|
type: 'string'
|
|
}
|
|
},
|
|
ui: {
|
|
legend: 'HAHA',
|
|
showLabel: false,
|
|
noLabelSpace: true
|
|
}
|
|
},
|
|
},
|
|
ui: {
|
|
widgetConfig: {
|
|
layout: 'v'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
];
|
|
|
|
// Bootstrap the app
|
|
new Vue({
|
|
el: '#demo',
|
|
data: {
|
|
formSchemas: _.cloneDeep(formSchemas),
|
|
originFormSchemas: formSchemas
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|