JavaScript/vue.js/dom属性值
来自康健生活
< JavaScript | vue.js
e.target.getAttribute
<li :class="item.value===''?isCountryClass:''" v-for="item in BospitalSearchFilters[0].options" :value="item.value"
@click="updateIsCountry($event)">
{{item.title}}
</li>
updateIsCountry(e) {
this.isCountry = e.target.getAttribute('value')
console.log(this)
},
ref
<li :class="item.value===''?isCountryClass:''" v-for="item in BospitalSearchFilters[0].options" :value="item.value"
@click="updateIsCountry($event)" ref="getValue">
{{item.title}}
</li>
updateIsCountry(e) {
this.isCountry = this.$refs.getValue.value
console.log(this)
},
@click
<li :class="item.value===''?isCountryClass:''" v-for="item in BospitalSearchFilters[0].options" :value="item.value"
@click="updateIsCountry($event, 'usa')">
{{item.title}}
</li>
updateIsCountry(e, str) {
console.log(str)
},
No categories