set default length

This commit is contained in:
Qiuxia Fan 2022-03-22 10:37:40 +08:00
parent 457a105644
commit c18b0507af

View File

@ -53,8 +53,9 @@ limitations under the License. -->
> >
<Icon <Icon
class="cp mr-5" class="cp mr-5"
v-show=" v-if="
index === states.metrics.length - 1 && states.metrics.length < 5 index === states.metrics.length - 1 &&
states.metrics.length < defaultLen
" "
iconName="add_circle_outlinecontrol_point" iconName="add_circle_outlinecontrol_point"
size="middle" size="middle"
@ -84,7 +85,7 @@ limitations under the License. -->
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { reactive } from "vue"; import { reactive, ref } from "vue";
import { Option } from "@/types/app"; import { Option } from "@/types/app";
import { useDashboardStore } from "@/store/modules/dashboard"; import { useDashboardStore } from "@/store/modules/dashboard";
import { import {
@ -128,6 +129,7 @@ const states = reactive<{
}); });
states.isList = ListChartTypes.includes(graph.type); states.isList = ListChartTypes.includes(graph.type);
const defaultLen = ref<number>(states.isList ? 5 : 10);
states.visTypes = setVisTypes(); states.visTypes = setVisTypes();
setDashboards(); setDashboards();
@ -241,10 +243,12 @@ function changeChartType(item: Option) {
}); });
states.metrics = [""]; states.metrics = [""];
states.metricTypes = [""]; states.metricTypes = [""];
defaultLen.value = 5;
} }
setMetricType(); setMetricType();
setDashboards(); setDashboards();
states.dashboardName = ""; states.dashboardName = "";
defaultLen.value = 10;
} }
function changeMetrics( function changeMetrics(