Files
EdgeAdmin/web/public/js/components/cluster/cluster-selector.js

29 lines
672 B
JavaScript
Raw Normal View History

2021-07-31 22:23:07 +08:00
// 单个集群选择
Vue.component("cluster-selector", {
2021-08-31 17:24:30 +08:00
props: ["v-cluster-id"],
mounted: function () {
let that = this
Tea.action("/clusters/options")
.post()
.success(function (resp) {
that.clusters = resp.data.clusters
})
},
data: function () {
let clusterId = this.vClusterId
if (clusterId == null) {
clusterId = 0
}
return {
clusters: [],
clusterId: clusterId
}
},
template: `<div>
2021-08-31 17:24:30 +08:00
<select class="ui dropdown" style="max-width: 10em" name="clusterId" v-model="clusterId">
<option value="0">[选择集群]</option>
<option v-for="cluster in clusters" :value="cluster.id">{{cluster.name}}</option>
</select>
</div>`
})