Skip to content

Commit e1f6125

Browse files
committed
Dev environment
1 parent 8a721d4 commit e1f6125

File tree

7 files changed

+514
-6
lines changed

7 files changed

+514
-6
lines changed

dev/index.html

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>vue-form-generator development</title>
6+
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.1/css/font-awesome.css">
7+
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css">
8+
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/css/bootstrap-select.min.css">
9+
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/7.0.2/css/bootstrap-slider.css">
10+
11+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.js"></script>
12+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.js"></script>
13+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/js/bootstrap-select.min.js"></script>
14+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/7.0.2/bootstrap-slider.min.js"></script>
15+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.3.0/lodash.min.js"></script>
16+
17+
<style>
18+
html {
19+
font-family: Tahoma;
20+
font-size: 14px;
21+
}
22+
23+
pre {
24+
overflow: auto;
25+
}
26+
pre .string { color: #885800; }
27+
pre .number { color: blue; }
28+
pre .boolean { color: magenta; }
29+
pre .null { color: red; }
30+
pre .key { color: green; }
31+
32+
</style>
33+
34+
</head>
35+
<body>
36+
<div id="app" class="container-fluid">
37+
<div class="row">
38+
<div class="col-md-6">
39+
<vue-form-generator :schema="schema", :model="model", :options="formOptions"></vue-form-generator>
40+
</div>
41+
<div class="col-md-6">
42+
<pre v-if="model">{{{ model | prettyJSON }}}</pre>
43+
</div>
44+
</div>
45+
</div>
46+
<script src="/app.js"></script>
47+
</body>
48+
</html>

dev/main.js

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import Vue from "vue";
2+
import VueFormGenerator from "../src";
3+
import Schema from "./schema";
4+
5+
$(function() {
6+
console.log($.fn.selectpicker);
7+
8+
var vm = new Vue({
9+
el: "#app",
10+
components: {
11+
"vue-form-generator": VueFormGenerator.component
12+
},
13+
14+
filters: {
15+
prettyJSON: function(json) {
16+
if (json) {
17+
json = JSON.stringify(json, undefined, 4);
18+
json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
19+
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
20+
var cls = 'number';
21+
if (/^"/.test(match)) {
22+
if (/:$/.test(match)) {
23+
cls = 'key';
24+
} else {
25+
cls = 'string';
26+
}
27+
} else if (/true|false/.test(match)) {
28+
cls = 'boolean';
29+
} else if (/null/.test(match)) {
30+
cls = 'null';
31+
}
32+
return '<span class="' + cls + '">' + match + '</span>';
33+
});
34+
}
35+
}
36+
},
37+
38+
data: {
39+
model: {
40+
id: 1,
41+
name: "John Doe",
42+
type: "personal",
43+
password: "J0hnD03!x4",
44+
skills: [
45+
"Javascript",
46+
"VueJS"
47+
],
48+
49+
language: "en-GB",
50+
age: 35,
51+
dob: 348966000000,
52+
rank: 6,
53+
address: {
54+
country: "United Kingdom",
55+
city: "London",
56+
street: "SW1A 5 Parliament St",
57+
geo: {
58+
lat: 51.501015,
59+
lng: -0.126005
60+
}
61+
},
62+
role: "admin",
63+
created: 1461834815864,
64+
bio: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam non lacus porttitor, pellentesque odio sit amet, hendrerit felis. In turpis mauris, viverra a lacinia nec, fringilla ut nisi. Curabitur rutrum mattis risus, at dapibus nisl tempus et. Interdum et malesuada fames ac ante ipsum primis in faucibus. Phasellus eget elementum lorem. Pellentesque tempor nec ante ut molestie. Suspendisse imperdiet tempus hendrerit. Morbi a dignissim augue.",
65+
status: true,
66+
67+
},
68+
69+
schema: Schema,
70+
71+
formOptions: {
72+
validateAfterLoad: true,
73+
validateAfterChanged: true
74+
}
75+
}
76+
});
77+
78+
});

0 commit comments

Comments
 (0)