index.uvue 31.4 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1 2 3 4 5 6
<template>
  <!-- #ifdef APP -->
  <scroll-view style="flex: 1">
    <!-- #endif -->
    <view>
      <uni-collapse>
DCloud-WZF's avatar
DCloud-WZF 已提交
7 8 9 10 11
        <uni-collapse-item
          v-for="menu in menus"
          :key="menu.id"
          :title="menu.name"
          class="menu">
DCloud-WZF's avatar
DCloud-WZF 已提交
12
          <view v-for="(page, index) in menu.pages" :key="page.name">
DCloud-WZF's avatar
DCloud-WZF 已提交
13 14 15 16 17 18 19 20 21 22
            <view
              v-if="page.url"
              class="page-item"
              :class="{ 'first-child': index == 0 }"
              @click="goDetailPage(menu.id, page)">
              <text
                :class="{ 'text-disabled': page.enable == false }"
                class="text"
                >{{ page.name }}</text
              >
DCloud-WZF's avatar
DCloud-WZF 已提交
23 24 25 26
            </view>
            <template v-if="page.children">
              <uni-collapse style="flex: 1">
                <uni-collapse-item :title="page.name" class="menu">
D
DCloud_LXH 已提交
27 28
                  <view
                    v-for="(child, index) in page.children"
DCloud-WZF's avatar
DCloud-WZF 已提交
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
                    :key="`${child.id}-${index}`">
                    <view
                      v-if="child.url"
                      class="page-item"
                      :class="{ 'first-child': index == 0 }"
                      @click="goDetailPage(`${menu.id}/${page.id}`, child)">
                      <text
                        :class="{ 'text-disabled': child.enable == false }"
                        class="text"
                        >{{ child.name }}</text
                      >
                    </view>
                    <template v-else>
                      <uni-collapse style="flex: 1">
                        <uni-collapse-item :title="child.name" class="menu">
                          <view
                            v-for="(childChild, index) in child.children"
                            :key="`${childChild.id}-${index}`">
                            <view
                              class="page-item"
                              :class="{ 'first-child': index == 0 }"
                              @click="
                                goDetailPage(
                                  `${menu.id}/${page.id}/${child.id}`,
                                  childChild
                                )
                              ">
                              <text
                                :class="{
                                  'text-disabled': childChild.enable == false,
                                }"
                                class="text"
                                >{{ childChild.name }}</text
                              >
                            </view>
                          </view>
                        </uni-collapse-item>
                      </uni-collapse>
                    </template>
DCloud-WZF's avatar
DCloud-WZF 已提交
68 69 70 71 72 73 74 75 76 77 78 79 80 81
                  </view>
                </uni-collapse-item>
              </uni-collapse>
            </template>
          </view>
        </uni-collapse-item>
      </uni-collapse>
    </view>
    <!-- #ifdef APP -->
  </scroll-view>
  <!-- #endif -->
</template>

<script lang="uts">
D
DCloud_LXH 已提交
82
import { setLifeCycleNum, state } from '@/store/index.uts'
DCloud-WZF's avatar
DCloud-WZF 已提交
83

D
DCloud_LXH 已提交
84 85 86 87 88 89 90
type Page = {
  id: string
  name: string
  enable?: boolean
  url?: string
  children?: Page[]
}
DCloud-WZF's avatar
DCloud-WZF 已提交
91

D
DCloud_LXH 已提交
92 93 94 95 96 97 98
type Menu = {
  id: string
  name: string
  pages: Page[]
  url?: string
  enable?: boolean
}
DCloud-WZF's avatar
DCloud-WZF 已提交
99

D
DCloud_LXH 已提交
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
export default {
  data() {
    return {
      menus: [
        {
          id: 'app-instance',
          name: 'App 实例',
          pages: [
            {
              id: 'component',
              name: 'component',
              url: 'component/component'
            },
            {
              id: 'globalProperties',
              name: 'globalProperties',
              children: [
                {
                  id: 'globalProperties-options',
                  name: 'globalProperties  选项式 API',
                  url: 'globalProperties-options'
                },
                {
                  id: 'globalProperties-composition',
                  name: 'globalProperties 组合式 API',
                  url: 'globalProperties-composition'
                }
              ]
            },
            {
              id: 'use',
              name: 'use',
              children: [
                {
                  id: 'use-options',
                  name: 'use 选项式 API',
                  url: 'use-composition'
                },
                {
                  id: 'use-composition',
                  name: 'use 组合式 API',
                  url: 'use-composition'
                }
              ]
            }
          ] as Page[]
        },
        {
          id: 'component-instance',
149
          name: '组件实例',
D
DCloud_LXH 已提交
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
          pages: [
            {
              id: 'attrs',
              name: 'attrs',
              children: [
                {
                  id: 'attrs-options',
                  name: 'attrs 选项式 API',
                  url: 'attrs-options'
                },
                {
                  id: 'attrs-composition',
                  name: 'attrs 组合式 API',
                  url: 'attrs-composition'
                }
              ]
            },
            {
              id: 'data',
              name: 'data',
              children: [
                {
                  id: 'data-options',
                  name: 'data 选项式 API',
                  url: 'data-options'
                },
                {
                  id: 'data-composition',
                  name: 'data 组合式 API',
                  url: 'data-composition'
                }
              ]
            },
            {
              id: 'props',
              name: 'props',
              children: [
                {
                  id: 'props-options',
                  name: 'props 选项式 API',
                  url: 'props-options'
                },
                {
                  id: 'props-composition',
                  name: 'props 组合式 API',
                  url: 'props-composition'
                }
              ]
            },
            {
              id: 'el',
              name: '$el',
              children: [
                {
                  id: 'el-options',
                  name: '$el 选项式 API',
                  url: 'el-options'
                },
                {
                  id: 'el-composition',
                  name: '$el 组合式 API',
                  url: 'el-composition'
                }
              ]
            },
            {
              id: 'options',
              name: '$options',
              children: [
                {
                  id: 'options-options',
                  name: '$options 选项式 API',
                  url: 'options-options'
                },
                {
                  id: 'options-composition',
                  name: '$options 组合式 API',
                  url: 'options-composition'
                }
              ]
            },
            {
              id: 'parent',
              name: '$parent',
              children: [
                {
                  id: 'parent-options',
                  name: '$parent 选项式 API',
                  url: 'parent-options'
                },
                {
                  id: 'parent-composition',
                  name: '$parent 组合式 API',
                  url: 'parent-composition'
                }
              ]
            },
            // #ifdef APP
            {
              id: 'root',
              name: '$root',
              children: [
                {
                  id: 'root-options',
                  name: '$root 选项式 API',
                  url: 'root-options'
                },
                {
                  id: 'root-composition',
                  name: '$root 组合式 API',
                  url: 'root-composition'
                }
              ]
263
            },
D
DCloud_LXH 已提交
264
            // #endif
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
            {
              id: 'slots',
              name: '$slots',
              children: [
                {
                  id: 'slots-options',
                  name: '$slots 选项式 API',
                  url: 'slots-options'
                },
                {
                  id: 'slots-composition',
                  name: '$slots 组合式 API',
                  url: 'slots-composition'
                }
              ]
D
DCloud_LXH 已提交
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
            },
            {
              id: 'refs',
              name: '$refs',
              children: [
                {
                  id: 'refs-options',
                  name: '$refs 选项式 API',
                  url: 'refs-options'
                },
                {
                  id: 'refs-composition',
                  name: '$refs 组合式 API',
                  url: 'refs-composition'
                }
              ]
D
DCloud_LXH 已提交
296 297 298 299 300 301 302 303 304 305 306 307 308
            },
            {
              id: 'emit-function',
              name: '$emit',
              children: [
                {
                  id: 'emit-options',
                  name: '$emit 选项式 API',
                  url: 'emit-function-options'
                },
                {
                  id: 'emit-composition',
                  name: 'defineEmits 组合式 API',
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
                  url: 'emit-function-composition'
                }
              ]
            },
            {
              id: 'force-update',
              name: '$force-update',
              children: [
                {
                  id: 'force-update-options',
                  name: '$forceUpdate 选项式 API',
                  url: 'force-update-options'
                },
                {
                  id: 'force-update-composition',
                  name: '$forceUpdate 组合式 API',
                  url: 'force-update-composition'
D
DCloud_LXH 已提交
326 327
                }
              ]
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
            },
            {
              id: 'methods',
              name: '$methods',
              children: [
                {
                  id: 'call-method-easycom-uni-modules-options',
                  name: '调用 uni_modules easycom 组件方法 选项式 API',
                  url: 'call-method-easycom-uni-modules-options'
                },
                {
                  id: 'call-method-easycom-uni-modules-composition',
                  name: '调用 uni_modules easycom 组件方法 组合式 API',
                  url: 'call-method-easycom-uni-modules-composition'
                },
                {
                  id: 'call-method-uni-element-options',
                  name: '调用内置组件方法 选项式 API',
                  url: 'call-method-uni-element-options'
                },
                {
                  id: 'call-method-uni-element-composition',
                  name: '调用内置组件方法 组合式 API',
                  url: 'call-method-uni-element-composition'
                },
                {
                  id: 'call-method-other-options',
                  name: '调用自定义组件方法 选项式 API',
                  url: 'call-method-other-options'
                },
                {
                  id: 'call-method-other-composition',
                  name: '调用自定义组件方法 组合式 API',
                  url: 'call-method-other-composition'
                }
              ]
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
            },
            {
              id: 'provide',
              name: 'provide',
              children: [
                {
                  id: 'provide-options-1',
                  name: 'provide 选项式 API 字面量方式',
                  url: 'provide-options-1'
                },
                {
                  id: 'provide-options-2',
                  name: 'provide 选项式 API 函数方式',
                  url: 'provide-options-2'
                },
                {
                  id: 'provide-composition',
                  name: 'provide 组合式 API',
                  url: 'provide-composition'
                },
              ]
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
            },
            {
              id: 'nextTick',
              name: 'nextTick',
              children: [
                {
                  id: 'nextTick-options',
                  name: 'nextTick 选项式 API',
                  url: 'nextTick-options'
                },
                {
                  id: 'nextTick-composition',
                  name: 'nextTick 组合式 API',
                  url: 'nextTick-composition'
                },
              ]
401 402 403 404 405
            },
            {
              id: 'setup-function',
              name: 'setup()',
              url: 'setup-function/setup-function'
406 407 408 409 410
            },
            {
              id: 'define-expose',
              name: 'defineExpose',
              url: 'define-expose/define-expose'
411 412 413 414
            },
            {
              id: 'circular-reference',
              name: 'circular reference',
415 416 417 418 419 420 421 422 423 424 425 426
              children: [
                {
                  id: 'circular-reference-options',
                  name: '循环引用 选项式 API',
                  url: 'circular-reference-options'
                },
                {
                  id: 'circular-reference-composition',
                  name: '循环引用 组合式 API',
                  url: 'circular-reference-composition'
                },
              ]
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
            },
            {
              id: 'mixins',
              name: 'mixins',
              children: [
                // #ifdef APP
                {
                  id: 'mixins-app',
                  name: 'mixins',
                  url: 'mixins-app'
                },
                {
                  id: 'mixins-app-page-namesake',
                  name: 'mixins page namesake',
                  url: 'mixins-app-page-namesake'
                },
                // #endif
                // #ifdef WEB
                {
                  id: 'mixins-web',
                  name: 'mixins',
                  url: 'mixins-web'
                },
                // #endif
              ]
452
            }
D
DCloud_LXH 已提交
453 454
          ] as Page[]
        },
455 456 457 458 459 460 461 462 463 464 465 466
        {
          id: 'reactivity',
          name: '响应式',
          pages: [
            {
              id: 'core',
              name: '核心',
              children: [
                {
                  id: 'ref',
                  name: 'ref',
                  url: 'ref/ref'
DCloud-WZF's avatar
DCloud-WZF 已提交
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483
                },
                {
                  id: 'computed',
                  name: 'computed',
                  children: [
                    {
                      id: 'computed-options',
                      name: 'computed 选项式 API',
                      url: 'computed-options'
                    },
                    {
                      id: 'computed-composition',
                      name: 'computed 组合式 API',
                      url: 'computed-composition'
                    },
                  ]
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
484 485 486 487 488
                {
                  id: 'reactive',
                  name: 'reactive',
                  url: 'reactive/reactive'
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
489 490 491 492 493
                {
                  id: 'readonly',
                  name: 'readonly',
                  url: 'readonly/readonly'
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509
                {
                  id: 'watch',
                  name: 'watch',
                  children: [
                    {
                      id: 'watch-options',
                      name: 'watch 选项式 API',
                      url: 'watch-options'
                    },
                    {
                      id: 'watch-composition',
                      name: 'watch 组合式 API',
                      url: 'watch-composition'
                    },
                  ]
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
510 511 512 513 514
                {
                  id: 'watch-effect',
                  name: 'watchEffect',
                  url: 'watch-effect/watch-effect'
                },
515 516 517 518 519
                {
                  id: 'watch-post-effect',
                  name: 'watchPostEffect',
                  url: 'watch-post-effect/watch-post-effect'
                },
520 521 522 523 524
                {
                  id: 'watch-sync-effect',
                  name: 'watchSyncEffect',
                  url: 'watch-sync-effect/watch-sync-effect'
                },
525
              ]
DCloud-WZF's avatar
DCloud-WZF 已提交
526 527 528 529 530 531 532 533 534 535
            },
            {
              id: 'utilities',
              name: '工具',
              children: [
                {
                  id: 'is-proxy',
                  name: 'isProxy',
                  url: 'is-proxy/is-proxy'
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
536 537 538 539 540
                {
                  id: 'is-reactive',
                  name: 'isReactive',
                  url: 'is-reactive/is-reactive'
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
541 542 543 544 545
                {
                  id: 'is-readonly',
                  name: 'isReadonly',
                  url: 'is-readonly/is-readonly'
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
546 547 548 549 550
                {
                  id: 'is-ref',
                  name: 'isRef',
                  url: 'is-ref/is-ref'
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
551 552 553 554 555
                {
                  id: 'to-ref',
                  name: 'toRef',
                  url: 'to-ref/to-ref'
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
556 557 558
                {
                  id: 'to-refs',
                  name: 'toRefs',
DCloud-WZF's avatar
DCloud-WZF 已提交
559
                  url: 'to-refs/to-refs',
DCloud-WZF's avatar
DCloud-WZF 已提交
560
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
561 562 563
                {
                  id: 'to-value',
                  name: 'toValue',
DCloud-WZF's avatar
DCloud-WZF 已提交
564 565
                  url: 'to-value/to-value',
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
566 567 568 569 570
                {
                  id: 'un-ref',
                  name: 'unRef',
                  url: 'un-ref/un-ref'
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
571
              ]
DCloud-WZF's avatar
DCloud-WZF 已提交
572 573 574 575 576 577 578 579 580 581
            },
            {
              id: 'advanced',
              name: '进阶',
              children: [
                {
                  id: 'custom-ref',
                  name: 'customRef',
                  url: 'custom-ref/custom-ref'
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
582 583 584 585 586
                {
                  id: 'effect-scope',
                  name: 'effectScope',
                  url: 'effect-scope/effect-scope'
                },
587 588 589 590 591
                {
                  id: 'get-current-scope',
                  name: 'getCurrentScope',
                  url: 'get-current-scope/get-current-scope'
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
592 593 594 595 596 597
                {
                  id: 'mark-raw',
                  name: 'markRaw',
                  url: 'mark-raw/mark-raw',
                  enable: false
                },
598 599 600 601 602
                {
                  id: 'on-scope-dispose',
                  name: 'onScopeDispose',
                  url: 'on-scope-dispose/on-scope-dispose'
                },
603 604 605 606 607
                {
                  id: 'shallow-reactive',
                  name: 'shallowReactive',
                  url: 'shallow-reactive/shallow-reactive'
                },
608 609 610 611 612
                {
                  id: 'shallow-readonly',
                  name: 'shallowReadonly',
                  url: 'shallow-readonly/shallow-readonly'
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
613 614 615 616 617
                {
                  id: 'shallow-ref',
                  name: 'shallowRef',
                  url: 'shallow-ref/shallow-ref'
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
618 619 620 621 622
                {
                  id: 'to-raw',
                  name: 'toRaw',
                  url: 'to-raw/to-raw'
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
623 624 625 626 627
                {
                  id: 'trigger-ref',
                  name: 'triggerRef',
                  url: 'trigger-ref/trigger-ref'
                },
DCloud-WZF's avatar
DCloud-WZF 已提交
628
              ]
629 630
            }
          ] as Page[]
DCloud-WZF's avatar
DCloud-WZF 已提交
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650
        },
         {
          id: 'directive',
          name: '指令',
          pages: [
            {
              id: 'v-html',
              name: 'v-html',
              children: [
                {
                  id: 'v-html-options',
                  name: 'v-html 选项式 API',
                  url: 'v-html-options'
                },
                {
                  id: 'v-html-composition',
                  name: 'v-html 组合式 API',
                  url: 'v-html-composition'
                },
              ]
DCloud-WZF's avatar
DCloud-WZF 已提交
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666
            },
            {
              id: 'v-show',
              name: 'v-show',
              children: [
                {
                  id: 'v-show-options',
                  name: 'v-show 选项式 API',
                  url: 'v-show-options'
                },
                {
                  id: 'v-show-composition',
                  name: 'v-show 组合式 API',
                  url: 'v-show-composition'
                },
              ]
DCloud-WZF's avatar
DCloud-WZF 已提交
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682
            },
            {
              id: 'v-if',
              name: 'v-if',
              children: [
                {
                  id: 'v-if-options',
                  name: 'v-if 选项式 API',
                  url: 'v-if-options'
                },
                {
                  id: 'v-if-composition',
                  name: 'v-if 组合式 API',
                  url: 'v-if-composition'
                },
              ]
DCloud-WZF's avatar
DCloud-WZF 已提交
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698
            },
            {
              id: 'v-for',
              name: 'v-for',
              children: [
                {
                  id: 'v-for-options',
                  name: 'v-for 选项式 API',
                  url: 'v-for-options'
                },
                {
                  id: 'v-for-composition',
                  name: 'v-for 组合式 API',
                  url: 'v-for-composition'
                },
              ]
DCloud-WZF's avatar
DCloud-WZF 已提交
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714
            },
            {
              id: 'v-on',
              name: 'v-on',
              children: [
                {
                  id: 'v-on-options',
                  name: 'v-on 选项式 API',
                  url: 'v-on-options'
                },
                {
                  id: 'v-on-composition',
                  name: 'v-on 组合式 API',
                  url: 'v-on-composition'
                },
              ]
DCloud-WZF's avatar
DCloud-WZF 已提交
715 716 717 718 719
            },
            {
              id: 'v-pre',
              name: 'v-pre',
              url: 'v-pre/v-pre'
DCloud-WZF's avatar
DCloud-WZF 已提交
720 721 722 723 724 725 726 727
            },
            {
              id: 'v-once',
              name: 'v-once',
              children: [
                {
                  id: 'v-once-options',
                  name: 'v-once 选项式 API',
D
DCloud_LXH 已提交
728
                  url: 'v-once-options'
DCloud-WZF's avatar
DCloud-WZF 已提交
729 730 731 732
                },
                {
                  id: 'v-once-composition',
                  name: 'v-once 组合式 API',
D
DCloud_LXH 已提交
733
                  url: 'v-once-composition'
DCloud-WZF's avatar
DCloud-WZF 已提交
734 735 736 737 738 739 740 741 742 743
                },
              ]
            },
            {
              id: 'v-memo',
              name: 'v-memo',
              children: [
                {
                  id: 'v-memo-options',
                  name: 'v-memo 选项式 API',
D
DCloud_LXH 已提交
744
                  url: 'v-memo-options'
DCloud-WZF's avatar
DCloud-WZF 已提交
745 746 747 748
                },
                {
                  id: 'v-memo-composition',
                  name: 'v-memo 组合式 API',
D
DCloud_LXH 已提交
749
                  url: 'v-memo-composition'
DCloud-WZF's avatar
DCloud-WZF 已提交
750 751 752
                },
              ]
            },
DCloud-WZF's avatar
DCloud-WZF 已提交
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774
            {
              id: 'v-text',
              name: 'v-text',
              children: [
                {
                  id: 'v-text-options',
                  name: 'v-text 选项式 API',
                  url: 'v-text-options',
                  // #ifdef APP
                  enable: false
                  // #endif
                },
                {
                  id: 'v-text-composition',
                  name: 'v-text 组合式 API',
                  url: 'v-text-composition',
                  // #ifdef APP
                  enable: false
                  // #endif
                },
              ]
            },
DCloud-WZF's avatar
DCloud-WZF 已提交
775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790
            {
              id: 'v-bind',
              name: 'v-bind',
              children: [
                {
                  id: 'v-bind-options',
                  name: 'v-bind 选项式 API',
                  url: 'v-bind-options',
                },
                {
                  id: 'v-bind-composition',
                  name: 'v-bind 组合式 API',
                  url: 'v-bind-composition',
                },
              ]
            },
DCloud-WZF's avatar
DCloud-WZF 已提交
791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806
            {
              id: 'v-model',
              name: 'v-model',
              children: [
                {
                  id: 'v-model-options',
                  name: 'v-model',
                  url: 'v-model-options',
                },
                {
                  id: 'v-model-composition',
                  name: 'defineModel',
                  url: 'v-model-composition',
                },
              ]
            },
807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822
            {
              id: 'v-slot',
              name: 'v-slot',
              children: [
                {
                  id: 'v-model-options',
                  name: 'v-slot',
                  url: 'v-slot-options',
                },
                {
                  id: 'v-slot-composition',
                  name: 'defineSlots',
                  url: 'v-slot-composition',
                },
              ]
            },
DCloud-WZF's avatar
DCloud-WZF 已提交
823
          ]
824
        },
D
DCloud_LXH 已提交
825 826 827 828 829 830 831 832 833 834
        {
          id: 'lifecycle',
          name: '生命周期',
          pages: [
            {
              id: 'page',
              name: '页面生命周期',
              children: [
                {
                  id: 'page-options',
835
                  name: '页面生命周期 选项式 API',
D
DCloud_LXH 已提交
836 837
                  url: 'page-options'
                },
838

D
DCloud_LXH 已提交
839 840
                {
                  id: 'page-composition',
841
                  name: '页面生命周期 组合式 API',
D
DCloud_LXH 已提交
842 843 844
                  url: 'page-composition'
                }
              ]
DCloud-WZF's avatar
DCloud-WZF 已提交
845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860
            }, {
              id: 'component',
              name: '组件生命周期',
              children: [
                {
                  id: 'component-options',
                  name: '组件生命周期 选项式 API',
                  url: 'component-options'
                },

                {
                  id: 'component-composition',
                  name: '组件生命周期 组合式 API',
                  url: 'component-composition'
                }
              ]
D
DCloud_LXH 已提交
861 862 863 864 865 866 867 868 869 870 871 872 873
            }
          ] as Page[]
        },
        {
          id: 'built-in',
          name: '内置组件',
          pages: [
            {
              id: 'component/keep-alive',
              name: 'keep-alive',
              children: [
                {
                  id: 'keep-alive-options',
874
                  name: 'keep-alive 选项式 API',
D
DCloud_LXH 已提交
875 876
                  url: 'keep-alive-options'
                },
877

D
DCloud_LXH 已提交
878 879
                {
                  id: 'keep-alive-composition',
880
                  name: 'keep-alive 组合式 API',
D
DCloud_LXH 已提交
881 882 883 884 885 886 887 888 889 890
                  url: 'keep-alive-composition'
                }
              ]
            },
            {
              id: 'component/teleport',
              name: 'teleport',
              children: [
                {
                  id: 'teleport-options',
891
                  name: 'teleport 选项式 API',
D
DCloud_LXH 已提交
892 893
                  url: 'teleport-options'
                },
894

D
DCloud_LXH 已提交
895 896
                {
                  id: 'teleport-composition',
897
                  name: 'teleport 组合式 API',
D
DCloud_LXH 已提交
898 899 900 901 902 903 904 905 906 907
                  url: 'teleport-composition'
                }
              ]
            },
            {
              id: 'component/component',
              name: 'component',
              children: [
                {
                  id: 'component-options',
908
                  name: 'component 选项式 API',
D
DCloud_LXH 已提交
909 910
                  url: 'component-options'
                },
911

D
DCloud_LXH 已提交
912 913
                {
                  id: 'component-composition',
914
                  name: 'component 组合式 API',
D
DCloud_LXH 已提交
915 916 917 918 919
                  url: 'component-composition'
                }
              ]
            },
            {
D
DCloud_LXH 已提交
920 921 922 923 924
              id: 'component/slots',
              name: 'slot',
              children: [
                {
                  id: 'slots-options',
925
                  name: 'slots 选项式 API',
D
DCloud_LXH 已提交
926 927 928 929 930
                  url: 'slots-options'
                },

                {
                  id: 'slots-composition',
931
                  name: 'slots 组合式 API',
D
DCloud_LXH 已提交
932 933 934 935 936 937 938 939 940 941
                  url: 'slots-composition'
                }
              ]
            },
            {
              id: 'component/template',
              name: 'template',
              children: [
                {
                  id: 'template-options',
942
                  name: 'template 选项式 API',
D
DCloud_LXH 已提交
943 944 945 946 947
                  url: 'template-options'
                },

                {
                  id: 'template-composition',
948
                  name: 'template 组合式 API',
D
DCloud_LXH 已提交
949 950 951 952
                  url: 'template-composition'
                }
              ]
            }
D
DCloud_LXH 已提交
953 954 955 956 957 958 959 960
          ] as Page[]
        },
        {
          id: 'rendering',
          name: '渲染',
          pages: [
            {
              id: 'render',
961
              name: 'render Function 选项式 API',
D
DCloud_LXH 已提交
962 963 964 965 966 967 968 969
              url: 'render/render'
            },
            {
              id: 'unrecognized-component',
              name: 'unrecognized-component',
              url: 'unrecognized-component/unrecognized-component'
            }
          ] as Page[]
D
DCloud_LXH 已提交
970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007
        },
        {
          id: 'examples',
          name: '示例',
          pages: [
            {
              id: 'nested-component-communication',
              name: '嵌套组件通讯',
              children: [
                {
                  id: 'nested-component-communication-options',
                  name: '选项式',
                  url: 'nested-component-communication-options'
                },
                {
                  id: 'nested-component-communication-composition',
                  name: '组合式',
                  url: 'nested-component-communication-composition'
                }
              ]
            },
            {
              id: 'set-custom-child-component-root-node-class',
              name: '自定义组件中使用 class 定制另一个自定义组件根节点样式',
              children: [
                {
                  id: 'set-custom-child-component-root-node-class-options',
                  name: '选项式',
                  url: 'set-custom-child-component-root-node-class-options'
                },
                {
                  id: 'set-custom-child-component-root-node-class-composition',
                  name: '组合式',
                  url: 'set-custom-child-component-root-node-class-composition'
                }
              ]
            }
          ] as Page[]
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029
        },
        {
          id: 'error',
          name: '异常示例',
          pages: [
            {
              id: 'runtime-error',
              name: '运行时异常',
              children: [
                {
                  id: 'runtime-error-options',
                  name: '运行时异常 选项式 API',
                  url: 'runtime-error-options'
                },
                {
                  id: 'runtime-error-composition',
                  name: '运行时异常 组合式 API',
                  url: 'runtime-error-composition'
                },
              ]
            }
          ]
D
DCloud_LXH 已提交
1030
        }
D
DCloud_LXH 已提交
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041
      ] as Menu[]
    }
  },
  methods: {
    goDetailPage(parentUrl: string, page: Page) {
      if (page.enable == false) {
        uni.showToast({
          icon: 'none',
          title: '暂不支持'
        })
        return
D
DCloud_LXH 已提交
1042
      }
D
DCloud_LXH 已提交
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058
      uni.navigateTo({
        url: `/pages/${parentUrl}/${page.url}`
      })
    },
    // 自动化测试
    setLifeCycleNum(num: number) {
      setLifeCycleNum(num)
    },
    // 自动化测试
    getLifeCycleNum(): number {
      return state.lifeCycleNum
    },
    // 自动化测试
    checkLaunchPath(): boolean {
      const app = getApp()
      return app.checkLaunchPath()
1059
    }
D
DCloud_LXH 已提交
1060 1061
  }
}
DCloud-WZF's avatar
DCloud-WZF 已提交
1062 1063 1064
</script>

<style lang="scss">
D
DCloud_LXH 已提交
1065 1066
.menu {
  border-bottom: 1px solid #dbd9d9;
D
DCloud_LXH 已提交
1067

D
DCloud_LXH 已提交
1068 1069
  &.open {
    border-bottom: none;
DCloud-WZF's avatar
DCloud-WZF 已提交
1070
  }
D
DCloud_LXH 已提交
1071
}
D
DCloud_LXH 已提交
1072

D
DCloud_LXH 已提交
1073 1074 1075
.page-item {
  padding: 12px 10px;
  border-bottom: 1px solid #dbd9d9;
D
DCloud_LXH 已提交
1076

D
DCloud_LXH 已提交
1077 1078 1079
  &.first-child {
    border-top: 1px solid #dbd9d9;
  }
D
DCloud_LXH 已提交
1080

D
DCloud_LXH 已提交
1081 1082 1083
  .text {
    font-size: 14px;
    color: #333;
D
DCloud_LXH 已提交
1084

D
DCloud_LXH 已提交
1085 1086
    &.text-disabled {
      color: #999;
DCloud-WZF's avatar
DCloud-WZF 已提交
1087 1088
    }
  }
D
DCloud_LXH 已提交
1089
}
DCloud-WZF's avatar
DCloud-WZF 已提交
1090
</style>