11import Taro from '@tarojs/taro'
2+ import { useState } from 'react'
23import {
34 View ,
45 Image ,
@@ -11,21 +12,19 @@ import {
1112 Video ,
1213 Textarea ,
1314} from '@tarojs/components'
15+ import { SearchBar } from '@/packages/searchbar/searchbar.taro'
1416import pkg from '@/packages/../config.json'
1517import packageJson from '@/packages/../../package.json'
1618import './index.scss'
17- // import Schema from 'async-validator'
1819
1920const navs = pkg . nav
20- // console.log(navs)
2121
2222// hack taro load button xml
2323console . log ( Button , Input , Video , Image , Swiper , SwiperItem , Textarea )
2424
25- // try {
26- // console.log('xxx', Schema)
27- // } catch (e) {}
25+
2826const Index = ( ) => {
27+ const [ search , setSearch ] = useState ( )
2928 const gotoNext = ( name : string , enName : string ) => {
3029 // 跳转到目的页面,打开新页面
3130 Taro . navigateTo ( {
@@ -67,15 +66,22 @@ const Index = () => {
6766 </ View >
6867 </ View >
6968 </ View >
70- < View className = "index-components" >
69+
70+ < View className = 'index-components' >
71+ { process . env . NODE_ENV === 'development' ? < >
72+ < SearchBar style = { { background : '#fff' } } placeholder = '' value = { search } onChange = { ( e ) => {
73+ setSearch ( e )
74+ } } />
75+ < View style = { { height : 25 } } > </ View >
76+ </ > : null }
7177 { navs . map ( ( nav ) => (
7278 < View key = { nav . enName } className = "index-components-item" >
7379 { nav . enName === 'dataentry' ? null : (
7480 < View className = "index-components-item-title" > { nav . name } </ View >
7581 ) }
7682 < View className = "index-components-sublist" >
7783 { nav . packages . map ( ( com ) =>
78- com . show && com . taro && com . version === '3.0.0' ? (
84+ com . show && com . taro && com . version === '3.0.0' && ( ! search || new RegExp ( search , 'ig' ) . test ( com . name . toLowerCase ( ) ) ) ? (
7985 < View
8086 key = { com . name }
8187 className = "index-components-sublist-item"
0 commit comments