@@ -48724,26 +48724,34 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
4872448724
4872548725/* harmony default export */ __webpack_exports__["default"] = ({
4872648726 props: ["fields"],
48727+ data: function data() {
48728+ return {
48729+ data: []
48730+ };
48731+ },
4872748732 created: function created() {
4872848733 this.change = __WEBPACK_IMPORTED_MODULE_0_debounce___default()(this.change, 500);
48734+
48735+ for (var i = 0; i < this.fields.length; i++) {
48736+ this.data.push({
48737+ name: this.fields[i].name,
48738+ value: this.fields[i].value
48739+ });
48740+ }
4872948741 },
4873048742
4873148743 methods: {
48732- change: function change() {
48733- var values = [];
48734- for (var i = 0; i < this.fields.length; i++) {
48735- var el = document.getElementById(this.fields[i].name);
48736-
48737- if (el.type == "checkbox") {
48738- if (el.checked) {
48739- values.push({ name: el.name, value: 1 });
48740- }
48741- } else if (el.value) {
48742- values.push({ name: el.name, value: el.value });
48743- }
48744+ change: function change(index, el) {
48745+
48746+ if (el.type == "checkbox") {
48747+ this.data[index].value = el.checked ? 1 : '';
48748+ } else {
48749+ this.data[index].value = el.value;
4874448750 }
4874548751
48746- this.$emit("changed", values);
48752+ this.$emit("changed", this.data.filter(function (item) {
48753+ return !!item.value;
48754+ }));
4874748755 }
4874848756 }
4874948757});
@@ -48845,20 +48853,32 @@ var render = function() {
4884548853 field.type == "number"
4884648854 ? _c("input", {
4884748855 directives: [{ name: "int", rawName: "v-int" }],
48848- attrs: { id: field.name, type: "text", name: field.name },
48849- domProps: { value: field.value },
48850- on: { input: _vm.change }
48856+ attrs: { type: "text", name: field.name },
48857+ domProps: { value: _vm.data.value },
48858+ on: {
48859+ input: function($event) {
48860+ _vm.change(index, $event.target)
48861+ }
48862+ }
4885148863 })
4885248864 : field.type == "checkbox"
4885348865 ? _c("input", {
48854- attrs: { id: field.name, type: "checkbox", name: field.name },
48855- domProps: { checked: field.value },
48856- on: { click: _vm.change }
48866+ attrs: { type: "checkbox", name: field.name },
48867+ domProps: { checked: _vm.data.value },
48868+ on: {
48869+ click: function($event) {
48870+ _vm.change(index, $event.target)
48871+ }
48872+ }
4885748873 })
4885848874 : _c("input", {
48859- attrs: { id: field.name, type: "text", name: field.name },
48860- domProps: { value: field.value },
48861- on: { input: _vm.change }
48875+ attrs: { type: "text", name: field.name },
48876+ domProps: { value: _vm.data.value },
48877+ on: {
48878+ input: function($event) {
48879+ _vm.change(index, $event.target)
48880+ }
48881+ }
4886248882 })
4886348883 ])
4886448884 }),
0 commit comments