+25
-2
lines changedFilter options
+25
-2
lines changed Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
1
1
<template>
2
-
<div>
2
+
<form>
3
3
<md-field>
4
4
<label>Counter</label>
5
5
<md-input v-model="regular" md-counter="30"></md-input>
@@ -24,7 +24,9 @@
24
24
<label>Textarea</label>
25
25
<md-textarea v-model="textarea" md-counter="80"></md-textarea>
26
26
</md-field>
27
-
</div>
27
+
28
+
<md-button class="md-raised" type="reset">RESET</md-button>
29
+
</form>
28
30
</template>
29
31
30
32
<script>
Original file line number Diff line number Diff line change
@@ -95,6 +95,23 @@ export default {
95
95
}
96
96
}
97
97
},
98
+
setFormResetListener () {
99
+
if (!this.$el.form) {
100
+
return
101
+
}
102
+
const parentForm = this.$el.form
103
+
parentForm.addEventListener('reset', this.onParentFormReset)
104
+
},
105
+
removeFormResetListener () {
106
+
if (!this.$el.form) {
107
+
return
108
+
}
109
+
const parentForm = this.$el.form
110
+
parentForm.removeEventListener('reset', this.onParentFormReset)
111
+
},
112
+
onParentFormReset () {
113
+
this.clearField()
114
+
},
98
115
setFieldValue () {
99
116
this.MdField.value = this.model
100
117
},
@@ -130,5 +147,9 @@ export default {
130
147
},
131
148
mounted () {
132
149
this.setLabelFor()
150
+
this.setFormResetListener()
151
+
},
152
+
beforeDestroy () {
153
+
this.removeFormResetListener()
133
154
}
134
155
}
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4