50 lines
891 B
Vue
50 lines
891 B
Vue
<template>
|
|
<PlansCards :plans="plansOption" v-model="selectedPlan" />
|
|
</template>
|
|
|
|
<script>
|
|
import PlansCards from '../PlansCards.vue';
|
|
|
|
export default {
|
|
props: ['modelValue', 'plans'],
|
|
emits: ['update:modelValue'],
|
|
components: {
|
|
PlansCards
|
|
},
|
|
computed: {
|
|
plansOption() {
|
|
return this.plans.map(plan => {
|
|
return {
|
|
...plan,
|
|
features: [
|
|
{
|
|
label: 'vCPU',
|
|
value: plan.vcpu
|
|
},
|
|
{
|
|
label: '内存',
|
|
value: this.$format.bytes(plan.memory, 0, 2)
|
|
},
|
|
{
|
|
label: '磁盘',
|
|
value: `${plan.disk} GB`
|
|
},
|
|
{
|
|
label: '实例类型',
|
|
value: plan.instance_type
|
|
}
|
|
]
|
|
};
|
|
});
|
|
},
|
|
selectedPlan: {
|
|
get() {
|
|
return this.modelValue;
|
|
},
|
|
set(value) {
|
|
this.$emit('update:modelValue', value);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
</script> |