mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-06 06:40:27 +08:00
优化界面
This commit is contained in:
23
web/public/js/components/common/radio.js
Normal file
23
web/public/js/components/common/radio.js
Normal file
@@ -0,0 +1,23 @@
|
||||
let radioId = 0
|
||||
Vue.component("radio", {
|
||||
props: ["name", "value", "v-value", "id"],
|
||||
data: function () {
|
||||
radioId++
|
||||
let elementId = this.id
|
||||
if (elementId == null) {
|
||||
elementId = "radio" + radioId
|
||||
}
|
||||
return {
|
||||
"elementId": elementId
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
change: function () {
|
||||
this.$emit("input", this.vValue)
|
||||
}
|
||||
},
|
||||
template: `<div class="ui checkbox radio">
|
||||
<input type="radio" :name="name" :value="vValue" :id="elementId" @change="change" :checked="(vValue == value)"/>
|
||||
<label :for="elementId"><slot></slot></label>
|
||||
</div>`
|
||||
})
|
||||
Reference in New Issue
Block a user