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
Show file tree
Hide file tree
Changes from all 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
7 changes: 6 additions & 1 deletion packages/nutui-taro-demo/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ const config = {
sourceRoot: 'src',
outputRoot: `dist/${process.env.TARO_ENV === 'h5' ? 'demo' : process.env.TARO_ENV}`,
plugins: [...plugins],
compiler: 'webpack5',
compiler: {
type: 'webpack5',
prebundle: {
exclude: ['@nutui/icons-react-taro']
},
},
alias:
process.env.TARO_ENV === 'rn' || process.env.TARO_ENV === 'jdrn'
? {
Expand Down
20 changes: 13 additions & 7 deletions packages/nutui-taro-demo/src/pages/index/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Taro from '@tarojs/taro'
import { useState } from 'react'
import {
View,
Image,
Expand All @@ -11,21 +12,19 @@ import {
Video,
Textarea,
} from '@tarojs/components'
import { SearchBar } from '@/packages/searchbar/searchbar.taro'
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, Textarea)

// 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 @@ -67,15 +66,22 @@ const Index = () => {
</View>
</View>
</View>
<View className="index-components">

<View className='index-components'>
{process.env.NODE_ENV === 'development' ? <>
<SearchBar style={{ background: '#fff' }} placeholder='' value={search} onChange={(e) => {
Comment on lines +71 to +72
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

修复 JSX 语法错误

代码中存在以下语法错误:

  1. JSX fragment 缺少闭合标签
  2. View 组件缺少闭合标签
- {process.env.NODE_ENV === 'development' ? <>
-   <SearchBar style={{ background: '#fff' }} placeholder='' value={search} onChange={(e) => {
-     setSearch(e)
-   }} />
-   <View style={{ height: 25 }}></View>
+ {process.env.NODE_ENV === 'development' ? (
+   <>
+     <SearchBar style={{ background: '#fff' }} placeholder='' value={search} onChange={(e) => {
+       setSearch(e)
+     }} />
+     <View style={{ height: 25 }}></View>
+   </>
+ ) : null}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{process.env.NODE_ENV === 'development' ? <>
<SearchBar style={{ background: '#fff' }} placeholder='' value={search} onChange={(e) => {
{process.env.NODE_ENV === 'development' ? (
<>
<SearchBar style={{ background: '#fff' }} placeholder='' value={search} onChange={(e) => {
setSearch(e)
}} />
<View style={{ height: 25 }}></View>
</>
) : null}
🧰 Tools
🪛 Biome (1.9.4)

[error] 72-72: JSX fragment has no corresponding closing tag.

Opening fragment

Closing tag

(parse)


[error] 71-72: Expected corresponding JSX closing tag for 'View'.

Opening tag

closing tag

(parse)

setSearch(e)
}} />
<View style={{ height: 25 }}></View>
</> : null}
{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 Down
Loading