Skip to content

Commit

Permalink
fix: 配置示例切换服务,模板不更新问题;2.打包map警告问题 --bug=126563845
Browse files Browse the repository at this point in the history
  • Loading branch information
q15971095971 committed Jun 29, 2024
1 parent 4ec62ac commit 01804e0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@
// 数据传递
const sendVal = () => {
// 处理数据格式用于展示
const newArr = labelArr.value.map((item) => {
const newArr: String[] = [];
labelArr.value.forEach((item) => {
if (item.key || item.value) {
return `"${item.key}":"${item.value}"`;
newArr.push(`"${item.key}":"${item.value}"`);
}
});
const filterArr = newArr.filter((item) => item !== undefined);
Expand Down
15 changes: 12 additions & 3 deletions bcs-services/bcs-bscp/ui/src/views/space/client/example/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@
</div>
</bk-alert>
<div class="content-wrap">
<component :is="currentTemplate" :kv-name="renderComponent" :content-scroll-top="contentScrollTop" />
<bk-loading style="height: 100%" :loading="loading">
<component :is="currentTemplate" :kv-name="renderComponent" :content-scroll-top="contentScrollTop" />
</bk-loading>
</div>
</div>
</section>
</template>

<script lang="ts" setup>
import { computed, ref, provide } from 'vue';
import { computed, ref, provide, nextTick } from 'vue';
import ServiceSelector from './components/service-selector.vue';
import { useI18n } from 'vue-i18n';
import ContainerExample from './components/content/container-example.vue';
Expand All @@ -52,12 +54,13 @@
const serviceName = ref(''); // 示例预览模板中用到
const serviceType = ref(''); // 配置类型:file/kv
const topTip = ref('');
const loading = ref(true);
provide('serviceName', serviceName); // 示例预览组件用
const navList = computed(() => (serviceType.value === 'file' ? fileTypeArr : kvTypeArr));
// 展示的示例组件与顶部提示语
const currentTemplate = computed(() => {
if (serviceType.value) {
if (serviceType.value && !loading.value) {
switch (renderComponent.value) {
case 'sidecar':
topTip.value = t('Sidecar 容器客户端用于容器化应用程序拉取文件型配置场景。');
Expand Down Expand Up @@ -87,12 +90,18 @@
// 服务切换
const changeService = (getServiceType: string, getServiceName: string) => {
serviceType.value = getServiceType;
if (serviceName.value !== getServiceName) {
loading.value = true;
}
serviceName.value = getServiceName;
changeTypeItem(navList.value[0].val);
};
// 服务的子类型切换
const changeTypeItem = (data: string) => {
renderComponent.value = data;
nextTick(() => {
loading.value = false;
});
};
// 返回顶部
const contentScrollTop = () => {
Expand Down

0 comments on commit 01804e0

Please sign in to comment.