This commit is contained in:
saeid
2019-05-10 19:27:01 +04:30
parent aa61c9e54f
commit ead396a3e5
51 changed files with 66077 additions and 16201 deletions
@@ -0,0 +1,51 @@
<template>
<div class="small">
<pie-chart :chart-data="datacollection"></pie-chart>
<bar-chart :chart-data="datacollection"></bar-chart>
<button @click="fillData()">Randomize</button>
</div>
</template>
<script>
import BarChart from '@/plugins/chart/BarChart.js'
import PieChart from '@/plugins/chart/PieChart.js'
export default {
components: {
BarChart,
PieChart
},
data () {
return {
datacollection: null
}
},
mounted () {
this.fillData()
},
methods: {
fillData () {
this.datacollection = {
labels: [this.getRandomInt(), this.getRandomInt()],
datasets: [
{
label: 'Data One',
backgroundColor: ['#f87979', '#ccc'],
data: [this.getRandomInt(), this.getRandomInt()]
}
]
}
},
getRandomInt () {
return Math.floor(Math.random() * (50 - 5 + 1)) + 5
}
}
}
</script>
<style>
.small {
max-width: 600px;
margin: 150px auto;
}
</style>
+10 -10
View File
@@ -73,7 +73,7 @@
<v-flex :class="['pa-2', item.size]" v-for="(item, key) in form" :key="key">
<v-text-field
v-if="item.type == 'Text'"
v-model="formData[item.name]"
v-model="formData[item.id]"
:label="item.name"
color="black"
></v-text-field>
@@ -81,7 +81,7 @@
multiple
v-if="item.type == 'Select'"
:items="item.options"
v-model="formData[item.name]"
v-model="formData[item.id]"
:label="item.name"
color="black"
item-text="title"
@@ -93,7 +93,7 @@
v-for="(optionValue, keyOption) in item.options"
:key="keyOption"
:label="optionValue.title"
v-model="formData[item.name]"
v-model="formData[item.id]"
:value="optionValue.id"
></v-checkbox>
</v-container>
@@ -109,7 +109,7 @@
>
<v-text-field
v-if="children.type == 'Text'"
v-model="formData[children.name]"
v-model="formData[children.id]"
:label="children.name"
color="black"
></v-text-field>
@@ -117,7 +117,7 @@
multiple
v-if="children.type == 'Select'"
:items="children.options"
v-model="formData[children.name]"
v-model="formData[children.id]"
:label="children.name"
color="black"
item-text="title"
@@ -129,7 +129,7 @@
v-for="(optionValue, keyOption) in children.options"
:key="keyOption"
:label="optionValue.title"
v-model="formData[children.name]"
v-model="formData[children.id]"
:value="optionValue.id"
></v-checkbox>
</v-container>
@@ -203,16 +203,16 @@ export default {
for (const keyForm in result.data.data.inputs[key].children) {
if (result.data.data.inputs[key].children.hasOwnProperty(keyForm)) {
if (result.data.data.inputs[key].children[keyForm].type == 'Checkbox' || result.data.data.inputs[key].children[keyForm].type == 'Select' ) {
this.formData[result.data.data.inputs[key].children[keyForm].name] = [];
this.formData[result.data.data.inputs[key].children[keyForm].id] = [];
} else {
this.formData[result.data.data.inputs[key].children[keyForm].name] = '';
this.formData[result.data.data.inputs[key].children[keyForm].id] = '';
}
}
}
} else if(result.data.data.inputs[key].type == 'Checkbox' || result.data.data.inputs[key].type == 'Select') {
this.formData[result.data.data.inputs[key].name] = [];
this.formData[result.data.data.inputs[key].id] = [];
} else {
this.formData[result.data.data.inputs[key].name] = '';
this.formData[result.data.data.inputs[key].id] = '';
}
}
}
+2
View File
@@ -106,6 +106,8 @@ export default {
if (value && value.length > 0) {
const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return pattern.test(value) || "Invalid e-mail.";
} else{
return true;
}
}
}