首页 > 其他分享 >test

test

时间:2023-02-17 00:44:35浏览次数:25  
标签:const treeData random genTreeNode value test id

<template>
{{treeData}}
  <a-tree-select
    v-model:value="value"
    v-model:searchValue="searchValue"
    tree-data-simple-mode
    tree-checkable
    multiple
    style="width: 100%"
    :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
    :tree-data="treeData"
    placeholder="Please select"
    :load-data="onLoadData"
    treeNodeFilterProp ='title'
  >
      <!-- <template #title="{ value: val, title }">
      <b v-if="val === '111'" style="color: #08c">3</b>
      <template v-else>
        <template
          v-for="(fragment, i) in title
            .toString()
            .split(new RegExp(`(?<=${searchValue})|(?=${searchValue})`, 'i'))"
        >
          <span
            v-if="fragment.toLowerCase() === searchValue.toLowerCase()"
            :key="i"
            style="color: #08c"
          >
            {{ fragment }}11
          </span>
          <template v-else>{{ fragment }}</template>
        </template>
      </template>
    </template> -->
  </a-tree-select>
</template>
<script lang="ts">
import type { TreeSelectProps } from 'ant-design-vue';
import { defineComponent, ref, watch } from 'vue';

export default defineComponent({
  setup() {
    const value = ref<string>();
    const treeData = ref<TreeSelectProps['treeData']>([
      { id: 1, pId: 0, value: '1', title: 'Expand to load' },
      { id: 2, pId: 0, value: '2', title: 'Expand to load' },
      { id: 3, pId: 0, value: '3', title: 'Tree Node', isLeaf: true },
    ]);

    watch(value, () => {
      console.log(value.value);
      console.log('treeData',treeData.value)
    });

    const genTreeNode = (parentId: number, isLeaf = false): TreeSelectProps['treeData'][number] => {
      const random = Math.random().toString(36).substring(2, 6);
      return {
        id: random,
        pId: parentId,
        value: random,
        title: isLeaf ? 'Tree Node' : 'Expand to load',
        isLeaf,
      };
    };
    const onl oadData = (treeNode: TreeSelectProps['treeData'][number]) => {
      return new Promise(resolve => {
        const { id } = treeNode.dataRef;
        setTimeout(() => {
          treeData.value = treeData.value.concat([
            genTreeNode(id, false),
            genTreeNode(id, true),
            genTreeNode(id, true),
          ]);
          console.log(treeData.value);
          resolve(true);
        }, 300);
      });
    };
    return {
       searchValue: ref(''),
      value,
      treeData,
      genTreeNode,
      onl oadData,
    };
  },
});
</script>

标签:const,treeData,random,genTreeNode,value,test,id
From: https://www.cnblogs.com/gzeal/p/17128763.html

相关文章

  • pytest参数化:@pytest.mark.parametrize
    内置的pytest.mark.parametrize装饰器可以用来对测试函数进行参数化处理。下面是一个典型的范例,检查特定的输入所期望的输出是否匹配:test_expectation.pyimportpytest......
  • optee km4.0 VTS:PerInstance/EncryptionOperationsTest.TripleDesEcbRoundTripSuccess
    异常日志1:#./VtsHalKeymasterV4_0TargetTest--gtest_filter=PerInstance/EncryptionOperationsTest.TripleDesEcbRoundTripSuccess/0_defaultNote:GoogleTestfilter......
  • unittest+数据读取
    测试数据分离unittest+文件存放测试数据数据驱动装饰圈ddt.ddtddt.data()unpackddt.file_data()文件读取txtreadlinesstripsplitjsonjson.......
  • pytest + yaml 框架 -19.根据 swagger.json 自动生成 yaml 格式自动化用例
    前言当项目中有很多个接口的时候,一个个去转成yaml文件的用例会很浪费时间,现在大部分格式的接口都有swagger.json接口文档。那么我们可以从swagger.json中解析出接口,......
  • py + python test1 score
    sC:\Lindows\lab\pytest\venv\Scripts\python.exeC:/Lindows/lab/pytest/hello.py-score=[80,70,90]#定义变量scoremin_grade=None#定义变量min_g......
  • AtCoder Beginner Contest 272 题解
    AtCoderBeginnerContest272Solution目录AtCoderBeginnerContest272Solution更好的阅读体验戳此进入题面链接题面Luogu链接abcd跳了[ABC272E]AddandMex题面S......
  • AtCoder Beginner Contest 266 题解
    AtCoderBeginnerContest266Solution目录AtCoderBeginnerContest266Solution更好的阅读体验戳此进入题面链接题面Luogu链接abcd都没什么可说的[ABC266E]Throwi......
  • unittest
    unittest框架:-丰富的断言类型-自动化测试-测试报告unittest框架的下载在python3中unittest是内置模块1.自定义的类必须继承TestCase,执行run函数,则会自动找以methodName......
  • Pytest-html报告优化+增加错误截图,获取统计数据
    1、在我们实际工作中,环境信息不一定要在报告中详细提现,可以增减2、用例信息,默认展示的是用例的model名::用例名称,并不直观,所以我们可以增加一个用例描述,直观描述用例的测......
  • springboot在test的时候,new的类报空指针
    ok@ComponentpublicclassFifthGithubCrawler{@AutowiredprivateKBComponentVersionRepositoryversionRepository;/***导出所有数据到json......