Skip to content

Commit e1bfad0

Browse files
committed
revert: Support with field variants (#1662)
This reverts commit fbf6d2a.
1 parent 4a8e40b commit e1bfad0

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

docs/app/pages/Components/File/examples/FileField.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,31 @@
11
<template>
22
<div>
33
<md-field>
4-
<md-icon md-file-trigger>attach_file</md-icon>
54
<label>Single</label>
65
<md-file v-model="single" />
76
</md-field>
87

98
<md-field>
10-
<md-icon md-file-trigger>attach_file</md-icon>
119
<label>Upload files</label>
1210
<md-file v-model="placeholder" placeholder="A nice input placeholder" />
1311
</md-field>
1412

1513
<md-field>
16-
<md-icon md-file-trigger>attach_file</md-icon>
1714
<label>Disabled</label>
1815
<md-file v-model="disabled" disabled/>
1916
</md-field>
2017

2118
<md-field>
22-
<md-icon md-file-trigger>attach_file</md-icon>
2319
<label>Initial value</label>
2420
<md-file v-model="initial" />
2521
</md-field>
2622

2723
<md-field>
28-
<md-icon md-file-trigger>attach_file</md-icon>
2924
<label>Multiple</label>
3025
<md-file v-model="multiple" multiple />
3126
</md-field>
3227

3328
<md-field>
34-
<md-icon md-file-trigger>attach_file</md-icon>
3529
<label>Only images</label>
3630
<md-file v-model="single" accept="image/*" />
3731
</md-field>

src/components/MdField/MdFile/MdFile.vue

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<template>
22
<div class="md-file">
3+
<md-file-icon @click.native="openPicker" />
4+
35
<input
46
class="md-input"
57
readonly
@@ -29,11 +31,6 @@
2931
},
3032
name: String
3133
},
32-
data () {
33-
return {
34-
triggerEl: null
35-
}
36-
},
3734
mixins: [MdFieldMixin],
3835
inject: ['MdField'],
3936
methods: {
@@ -76,20 +73,8 @@
7673
created () {
7774
this.MdField.file = true
7875
},
79-
mounted () {
80-
this.$nextTick().then(() => {
81-
this.triggerEl = this.MdField.$el.querySelector('[md-file-trigger]')
82-
if (this.triggerEl) {
83-
this.triggerEl.addEventListener('click', this.openPicker)
84-
}
85-
})
86-
},
8776
beforeDestroy () {
8877
this.MdField.file = false
89-
90-
if (this.triggerEl) {
91-
this.triggerEl.removeEventListener('click', this.openPicker)
92-
}
9378
}
9479
}
9580
</script>
@@ -114,12 +99,4 @@
11499
cursor: pointer;
115100
}
116101
}
117-
118-
.md-field {
119-
&.md-has-file {
120-
[md-file-trigger] {
121-
cursor: pointer;
122-
}
123-
}
124-
}
125102
</style>

0 commit comments

Comments
 (0)