mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 21:50:28 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			643 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			643 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
Vue.component("ns-cluster-selector", {
 | 
						|
	props: ["v-cluster-id"],
 | 
						|
	mounted: function () {
 | 
						|
		let that = this
 | 
						|
 | 
						|
		Tea.action("/ns/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>
 | 
						|
	<select class="ui dropdown auto-width" name="clusterId" v-model="clusterId">
 | 
						|
		<option value="0">[选择集群]</option>
 | 
						|
		<option v-for="cluster in clusters" :value="cluster.id">{{cluster.name}}</option>
 | 
						|
	</select>
 | 
						|
</div>`
 | 
						|
}) |