Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: components can be searched #2757

Merged
merged 7 commits into from
Dec 6, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions packages/nutui-taro-demo/src/pages/index/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import Taro from '@tarojs/taro'
import { View, Image, Swiper, SwiperItem, Text, ScrollView, Button, Input, Video } from '@tarojs/components'
import { useState } from 'react'
import { Button, Image, Input, ScrollView, Swiper, SwiperItem, Text, Video, View } from '@tarojs/components'
import {SearchBar} from '@/packages/searchbar/searchbar'
import pkg from '@/packages/../config.json'
import packageJson from '@/packages/../../package.json'
import './index.scss'
// import Schema from 'async-validator'

const navs = pkg.nav
// console.log(navs)


// hack taro load button xml
console.log(Button, Input, Video,Image, Swiper, SwiperItem, )
console.log(Button, Input, Video, Image, Swiper, SwiperItem)

// try {
// console.log('xxx', Schema)
// } catch (e) {}
const Index = () => {
const [search, setSearch] = useState()
oasis-cloud marked this conversation as resolved.
Show resolved Hide resolved
const gotoNext = (name: string, enName: string) => {
// 跳转到目的页面,打开新页面
Taro.navigateTo({
Expand Down Expand Up @@ -55,15 +52,20 @@ const Index = () => {
</View>
</View>
</View>

<View className='index-components'>
<SearchBar style={{background: '#fff'}} placeholder='...' value={search} onChange={(e) => {
setSearch(e)
}} />
<View style={{height: 25}}></View>
{navs.map((nav) => (
<View key={nav.enName} className='index-components-item'>
{nav.enName === 'dataentry' ? null : (
<View className='index-components-item-title'>{nav.name}</View>
)}
<View className='index-components-sublist'>
{nav.packages.map((com) =>
com.show && com.taro && com.version === '3.0.0' ? (
com.show && com.taro && com.version === '3.0.0' && (!search || new RegExp(search, 'ig').test(com.name.toLowerCase())) ? (
<View
key={com.name}
className='index-components-sublist-item'
Expand All @@ -76,7 +78,7 @@ const Index = () => {
{com.name}
</View>
</View>
) : null
) : null,
)}
</View>
</View>
Expand Down
Loading