mirror of
https://github.com/vxcontrol/ncform.git
synced 2026-06-30 22:17:58 -04:00
58 lines
1.9 KiB
JavaScript
Executable File
58 lines
1.9 KiB
JavaScript
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Ncform Playground</title>
|
|
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
|
</head>
|
|
<style>
|
|
* {margin: 0; padding: 0;}
|
|
.invalid-feedback {
|
|
margin-top: .25rem;
|
|
font-size: .875rem;
|
|
color: #dc3545;
|
|
}
|
|
</style>
|
|
|
|
<body>
|
|
|
|
<!--演示区域-->
|
|
<div id="demo">
|
|
<playground></playground>
|
|
</div>
|
|
<script type="text/javascript" src="../../../node_modules/ace-builds/src-min-noconflict/ace.js"></script>
|
|
<script type="text/javascript" src="../../../node_modules/vue/dist/vue.min.js"></script>
|
|
<script type="text/javascript" src="../../../node_modules/@ncform/ncform-common/dist/ncformCommon.js"></script>
|
|
<script type="text/javascript" src="../../../node_modules/@ncform/ncform/dist/vueNcform.js"></script>
|
|
<script type="text/javascript" src="../../../node_modules/@ncform/ncform-theme-elementui/dist/ncformStdComps.min.js"></script>
|
|
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
|
|
<script src="https://unpkg.com/mockjs"></script>
|
|
<script src="https://unpkg.com/js-url"></script>
|
|
<script type="text/javascript" src="../../../dist/playground.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
Mock.mock(/getProvinces/, function (options) {
|
|
return [{ "id": 1, "name": "广东" }, { "id": 2, "name": "北京" }]
|
|
})
|
|
Mock.mock(/getCities/, function (options) {
|
|
let params = url('?', options.url) || {};
|
|
let result = {
|
|
1: [{ id: 10, name: '广州' }, { id: 20, name: '汕头' }],
|
|
2: [{ id: 30, name: '北京' }]
|
|
}
|
|
let res = result[params.provinceId] || [];
|
|
return res.filter(item => !params.keyword || item.name.indexOf(params.keyword) >= 0);
|
|
})
|
|
|
|
Vue.use(vueNcform, { extComponents: ncformStdComps });
|
|
// Bootstrap the app
|
|
new Vue({
|
|
el: '#demo',
|
|
components: {
|
|
playground: playground.default
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|