Files
EdgeAdmin/web/public/js/components/ns/ns-route-selector.js

30 lines
675 B
JavaScript
Raw Normal View History

// 选择单一线路
Vue.component("ns-route-selector", {
2021-08-09 13:56:11 +08:00
props: ["v-route-code"],
mounted: function () {
let that = this
Tea.action("/ns/routes/options")
.post()
.success(function (resp) {
that.routes = resp.data.routes
})
},
data: function () {
2021-08-09 13:56:11 +08:00
let routeCode = this.vRouteCode
if (routeCode == null) {
routeCode = ""
}
return {
2021-08-09 13:56:11 +08:00
routeCode: routeCode,
routes: []
}
},
template: `<div>
<div v-if="routes.length > 0">
2021-08-09 13:56:11 +08:00
<select class="ui dropdown" name="routeCode" v-model="routeCode">
<option value="">[线路]</option>
<option v-for="route in routes" :value="route.code">{{route.name}}</option>
</select>
</div>
</div>`
})