React Native项目开发(iOS侧为例)

本文主要是详细讲解一下使用以下指令创建应用后,带领大家使用 typeScript 搭建两个简单页面。

bash 复制代码
npx @react-native-community/cli@latest init RnIosDemo --skip-install 

一、安装依赖并初始化 TypeScript

由于安装指令中使用了 --skip-install ,首先需要在项目根目录下安装依赖,然后初始化 TypeScript 环境。现代版本的 React Native (0.71+) 已经原生支持 TypeScript,无需像旧版本那样安装复杂的转换器。

1、进入项目目录

bash 复制代码
cd RnIosDemo

2、安装 npm 依赖

bash 复制代码
npm install
# 或
yarn install

3、‌**创建/检查 tsconfig.json**‌

在项目根目录下创建一个 tsconfig.json 文件。这是 TypeScript 的核心配置文件。对于 React Native,推荐的基础配置如下:

bash 复制代码
{
  "compilerOptions": {
    "target": "esnext",
    "module": "commonjs",
    "lib": ["es2019"],
    "allowJs": true,
    "jsx": "react-native",
    "noEmit": true,
    "isolatedModules": true,
    "strict": true,
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true
  },
  "include": ["src/**/*", "*.tsx", "*.ts"],
  "exclude": ["node_modules", "babel.config.js", "metro.config.js"]
}

注意 :"jsx": "react-native"* 是关键配置,它告诉 TypeScript 如何处理 JSX 语法。*

4‌、重命名入口文件(可选但推荐)

‌ React Native 的打包入口通常是 index.js 。‌请保留 index.js 不变 ‌,因为它是原生应用加载 JS Bundle 的入口。你可以在 index.js 中引入 TypeScript 文件,或者将主要的 App 逻辑写在 .tsx 文件中。


二、新增 Entrance.tsx 页面

1、创建基础菜单

在项目 根目录 下,创建 src 目录,此目录为 React Native 项目的主要业务代码的开发目录。在 src 目录下 创建 screens 目录(建议) 或直接创建 Entrance.tsx 。

2、编写代码

TypeScript 复制代码
// Entrance.tsx
import React from 'react';
import { View, Text, StyleSheet, SafeAreaView } from 'react-native';

// 1. 定义 Props 类型(如果该组件需要接收参数)
interface EntranceProps {
  title?: string;
}

// 2. 创建函数式组件
const Entrance: React.FC<EntranceProps> = ({ title = 'Welcome to RN' }) => {
  return (
    <SafeAreaView style={styles.container}>
      <View style={styles.content}>
        <Text style={styles.title}>首页</Text>
        <Text style={styles.subtitle}>
           这是入口首页
        </Text>
      </View>
    </SafeAreaView>
  );
};

// 3. 定义样式
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#f5f5f5',
  },
  content: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  title: {
    fontSize: 24,
    fontWeight: 'bold',
    marginBottom: 10,
    color: '#333',
  },
  subtitle: {
    fontSize: 16,
    color: '#666',
  },
});

export default Entrance;

3、将 Entrance.tsx 配置到项目中

在 React Native 中,"配置"页面通常意味着将其渲染到应用的根组件中。我们需要修改项目的入口文件**App.tsx** (如果不存在则创建,或者修改现有的**App.js** 为 App.tsx)。

1、如果你希望 Entrance 作为整个 App 的主界面

1、找到 或创建 App.tsx

如果项目中只有 App.js 你可以将其重命名为 App.tsx ,或者新建一个 App.tsx 并确保 index.js 引用的是它。

2、修改 App.tsx 内容

引入刚才创建的 Entrance 组件并将其返回。

TypeScript 复制代码
// App.tsx
import React from 'react';
import Entrance from './Entrance'; // 确保路径正确,如果在 src 文件夹则是 './src/Entrance'

const App = () => {
  return <Entrance />;
};

export default App;
3、检查 index.js 文件

打开根目录下的 index.js 文件,确保已经注册了 App 组件。

TypeScript 复制代码
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';

AppRegistry.registerComponent(appName, () => App);
1、安装导航依赖(关键!页面跳转必须)

React Native 默认不带陆游导航,我们用官方推荐的React Navigation。

bash 复制代码
# 核心导航库
npm install @react-navigation/native @react-navigation/native-stack

# 原生依赖(iOS 必须)
npm install react-native-screens react-native-safe-area-context

注意 ‌:react-native-screens 能显著提升导航性能,**react-native-safe-area-context**用于处理刘海屏等安全区域问题,这两个是官方推荐必装的。

2、配置 App.tsx(导航入口)

我们需要修改**App.tsx** ,将其包裹在 NavigationContainer 中,并定义导航结构。让 **Entrance.tsx**作为首页。

TypeScript 复制代码
// App.tsx
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import Entrance from './Entrance'; // 引入你之前创建的 Entrance 组件

// 1. 创建栈导航器对象
const Stack = createNativeStackNavigator();

const App = () => {
  return (
    // 2. NavigationContainer 是必须的顶层组件,管理导航状态
    <NavigationContainer>
      {/* 3. Stack.Navigator 定义页面堆栈 */}
      <Stack.Navigator 
        initialRouteName="Entrance" // 设置初始显示的页面名称
        screenOptions={{
          headerStyle: { backgroundColor: '#fff' }, // 可选:自定义头部样式
          headerTitleAlign: 'center',
        }}
      >
        {/* 4. 注册页面 */}
        <Stack.Screen 
          name="Entrance" 
          component={Entrance} 
          options={{ title: '欢迎页' }} // 可选:设置顶部标题
        />
      </Stack.Navigator>
    </NavigationContainer>
  );
};

export default App;
3、优化导航 Entrance.tsx 支持导航参数
TypeScript 复制代码
// Entrance.tsx
import React from 'react';
import { View, Text, StyleSheet, SafeAreaView, Button } from 'react-native';
import { NativeStackScreenProps } from '@react-navigation/native-stack';

// 1. 定义路由参数类型(如果当前页面不需要传参,可以定义为 undefined 或 Record<string, undefined>)
type RootStackParamList = {
  Entrance: undefined;
  // Detail: { id: string }; // 示例:如果有详情页,可以这样定义
};

// 2. 使用 NativeStackScreenProps 获取 navigation 和 route 的类型提示
type EntranceScreenProps = NativeStackScreenProps<RootStackParamList, 'Entrance'>;

const Entrance: React.FC<EntranceScreenProps> = ({ navigation, route }) => {
  
  const handlePress = () => {
    console.log('按钮被点击');
    // 未来如果有其他页面,可以使用 navigation.navigate('PageName')
  };

  return (
    <SafeAreaView style={styles.container}>
      <View style={styles.content}>
        <Text style={styles.title}>Welcome to RN</Text>
        <Text style={styles.subtitle}>This is your first TSX page with Navigation.</Text>
        
        <View style={{ marginTop: 20 }}>
          <Button title="点击测试" onPress={handlePress} />
        </View>
      </View>
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#f5f5f5',
  },
  content: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  title: {
    fontSize: 24,
    fontWeight: 'bold',
    marginBottom: 10,
    color: '#333',
  },
  subtitle: {
    fontSize: 16,
    color: '#666',
  },
});

export default Entrance;
4、运行与验证
1、重新编译 iOS 应用

由于安装了新的原生依赖(react-native-screens 等),你需要重新运行 iOS 构建命令

TypeScript 复制代码
npm run ios
2、验证效果
  • 应用启动后,你应该能看到 Entrance 页面。
  • 顶部应该有一个导航栏(Header),标题显示为"欢迎页"(如果你在 App.tsx 中设置了 options={``{ title: '欢迎页' }})。
  • 如果没有报错,说明 React Navigation 已成功集成。

3、注意

因项目大多是多页面应用场景,因此本文后续采取 React Navigation 方案配置页面。


三、新增 Profile.tsx 我的页面

1、在 Entrance.tsx 文件同级 创建 Profile.tsx 文件

TypeScript 复制代码
import {View,Text} from "react-native"

interface ProfileProps {

}

const Profile :React.FC<ProfileProps>  = () =>{

    return (
        <View>
            <Text>我的页面</Text>
        </View>
    )
}

export default Profile;

2、在 App.tsx 中导入 页面

TypeScript 复制代码
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 */

import { NewAppScreen } from '@react-native/new-app-screen';
import { StatusBar, StyleSheet, useColorScheme, View } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';

import Entrance from './src/screens/entrance';
import Profile from './src/screens/profile'


// 1. 创建栈导航器对象
const Stack = createNativeStackNavigator();

function App() {
  const isDarkMode = useColorScheme() === 'dark';

  return (
    // 2. 包裹导航容器,是必须的顶层组件,管理导航状态
    <NavigationContainer>
      <Stack.Navigator
        initialRouteName="Entrance" // 设置初始显示的页面名称
        screenOptions={{
          headerShown: true, // 显示/隐藏导航栏
          headerTitle: 'Welcome to RN', // 导航栏标题
          headerStyle: { // 导航栏样式
            backgroundColor: '#f5f5f5',
          },
          headerTitleStyle: { // 导航栏标题样式
            fontSize: 20,
            fontWeight: 'bold',
          },
          headerTitleAlign: 'center', // 导航栏标题对齐方式
        }}
      >
        {/* 注册页面 */}
        <Stack.Screen
          name="Entrance"
          component={Entrance}
          options={{
            title: 'Entrance',
          }}
        />
      {/* 我的页面 */}
        <Stack.Screen
          name="Profile"
          component={Profile}
          options={{
            title: 'Profile',
          }}
        />
      </Stack.Navigator>
    </NavigationContainer>
  );
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
});

export default App;

3、修改 Entrance.tsx 增加点击按钮,使其可以跳转至 Profile 页面

TypeScript 复制代码
// Entrance.tsx
import React from 'react';
import { View, Text, StyleSheet, SafeAreaView, Button } from 'react-native';
import { NativeStackScreenProps } from '@react-navigation/native-stack';

// 1. 定义路由参数类型(如果当前页面不需要传参,可以定义为 undefined 或 Record<string, undefined>)
type RootStackParamList = {
  Entrance: undefined;
  // Detail: { id: string }; // 示例:如果有详情页,可以这样定义
};

// 2. 使用 NativeStackScreenProps 获取 navigation 和 route 的类型提示
type EntranceScreenProps = NativeStackScreenProps<RootStackParamList, 'Entrance'>;

const Entrance: React.FC<EntranceScreenProps> = ({ navigation, route }) => {
  
  const handlePress = () => {
    console.log('按钮被点击');
    navigation.navigate('Profile');
  };

  return (
    <SafeAreaView style={styles.container}>
      <View style={styles.content}>
        <Text style={styles.title}>Welcome to RN</Text>
        <Text style={styles.subtitle}>This is your first TSX page with Navigation.</Text>
        
        <View style={{ marginTop: 20 }}>
          <Button title="我的页面" onPress={handlePress} />
        </View>
      </View>
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#f5f5f5',
  },
  content: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  title: {
    fontSize: 24,
    fontWeight: 'bold',
    marginBottom: 10,
    color: '#333',
  },
  subtitle: {
    fontSize: 16,
    color: '#666',
  },
});

export default Entrance;

4、页面报错

报错 1

报错信息:

不能将类型"FC<EntranceScreenProps> "分配给类型"ScreenComponentType<ParamListBase, "Entrance"> | undefined "。不能将类型"FunctionComponent<EntranceScreenProps> "分配给类型"FunctionComponent<{}>"。

原因:

Entrance**.tsx** 中局部定义 了 RootStackParamList ,但 App.tsx 中的 Stack 导航器并不知道这个类型定义。导航器的类型默认是 ParamListBase (即每个路由参数都是 {}),而你的 Entrance 组件声明需要 EntranceScreenProps (包含 navigation 和 route),两者不匹配

解决方案:

核心思路:将 RootStackParamList 提取为共享类型,并让 createNativeStackNavigator 使用它。

1、创建共享的导航类型文件

一般在 src 目录下创建 types/navigation.ts 文件

TypeScript 复制代码
import {NativeStackScreenProps} from "@react-navigation/native-stack"

// 1、定义所有路由及其参数映射
export type RootStackParamList = {
    Entrance: undefined; // 入口页面 如果不需要传参 设为 undefined
    Profile: undefined;
}

// 2、导出特定页面的props类型
export type EntranceProps = NativeStackScreenProps<RootStackParamList, 'Entrance'>
export type ProfileProps = NativeStackScreenProps<RootStackParamList, 'Profile'>

// 3、全局注册路由参数类型
declare global {
  namespace ReactNavigation {
    interface RootParamList extends RootStackParamList {}
  }
}
2、修改 App.tsx 文件,让 createNativeStackNavigator 使用共享类型
TypeScript 复制代码
import { StyleSheet, useColorScheme } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';

import {RootStackParamList} from './src/typs/navigation'


// 1. 创建栈导航器对象
const Stack = createNativeStackNavigator<RootStackParamList>();
3、修改 Entrance.tsx 和 Profile.tsx 文件,移除局部类型定义,改用共享类型
TypeScript 复制代码
// Entrance.tsx
import React from 'react';
import { View, Text, StyleSheet, SafeAreaView, Button } from 'react-native';
import {EntranceProps} from '../typs/navigation'

const Entrance: React.FC<EntranceProps> = ({ navigation, route }) => {
  
  const handlePress = () => {
    console.log('按钮被点击');
    // 未来如果有其他页面,可以使用 navigation.navigate('Profile')
    navigation.navigate('Profile');
  };
}
TypeScript 复制代码
import {View,Text} from "react-native"
import {ProfileProps} from '../typs/navigation'

const Profile :React.FC<ProfileProps>  = () =>{

    return (
        <View>
            <Text>我的页面</Text>
        </View>
    )
}

export default Profile;
4、重新编译运行

四、独立配置 页面路由

1、创建 /src/navigation/index.ts

TypeScript 复制代码
// src/types/navigation.ts
import Entrance from '../screens/entrance';
import Profile from '../screens/profile';

// 1. 全局定义所有路由的名称和对应参数的映射关系
// 新增页面时只需要在这里新增一行,即可获得完整的 TypeScript 类型提示
import { RootStackParamList, RouteConfig } from '../types/navigation';
import { createNavigationContainerRef } from '@react-navigation/native';
import { isEmpty } from '../utils/utils';

// 2. 全局创建带类型约束的 Stack 导航器实例
// 后续所有页面跳转、路由注册都会自动获得类型校验,避免页面名拼写错误、传参不符合约定的问题
export const RootStack = createNativeStackNavigator<RootStackParamList>();

// 3. 抽离统一的全局导航配置(把你之前写在 App.tsx 里的公共配置移到这里)
export const globalScreenOptions = {
  headerShown: true,
  headerTitle: 'Welcome to RN',
  headerStyle: {
    backgroundColor: '#f5f5f5',
  },
  headerTitleStyle: {
    fontSize: 20,
    fontWeight: 'bold',
  },
  headerTitleAlign: 'center' as const,
};

2、抽离独立的导航配置常量

仍在文件**/src/** navigation/index.ts 中增加

TypeScript 复制代码
// 全局路由配置数组,所有页面注册都集中在这里维护
export const AppRouteConfigs: RouteConfig[] = [
  {
    name: 'Entrance',
    component: Entrance,
    options: {
      title: 'Entrance',
    },
  },
  {
    name: 'Profile',
    component: Profile,
    options: {
      title: 'Profile',
    },
  },
];

3、修改入口 App.tsx 引用抽离后的配置

TypeScript 复制代码
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 */

import { StyleSheet, useColorScheme } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';

import {RootStackParamList} from './src/types/navigation'

import { AppRouteConfigs, RootStack } from './src/navigation';


// 1. 创建栈导航器对象
const Stack = createNativeStackNavigator<RootStackParamList>();

function App() {
  return (
    // 2. 包裹导航容器,是必须的顶层组件,管理导航状态
    <NavigationContainer>
      <Stack.Navigator
        initialRouteName="Entrance" // 设置初始显示的页面名称
        screenOptions={{
          headerShown: true, // 显示/隐藏导航栏
          headerTitle: 'Welcome to RN', // 导航栏标题
          headerStyle: { // 导航栏样式
            backgroundColor: '#f5f5f5',
          },
          headerTitleStyle: { // 导航栏标题样式
            fontSize: 20,
            fontWeight: 'bold',
          },
          headerTitleAlign: 'center', // 导航栏标题对齐方式
        }}
      >
         {/* 遍历渲染所有注册的页面,不需要手动逐个写 Stack.Screen */}
        {AppRouteConfigs.map((route) => (
          <RootStack.Screen
            key={route.name}
            name={route.name}
            component={route.component}
            options={route.options}
          />
        ))}
      </Stack.Navigator>
    </NavigationContainer>
  );
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
});

export default App;

4、拓展

可以在同一个 navigation.ts 文件中补充全局导航工具方法,解决在组件外无法调用 **navigation.navigate**的问题:

TypeScript 复制代码
// 全局导航实例引用,用于在任何地方调用导航函数
export const navigationRef = createNavigationContainerRef<RootStackParamList>();
// 全局导航函数,支持参数传递
export function navigate<T extends keyof RootStackParamList>(
  name: T,
  params?: RootStackParamList[T]
) {
  if (navigationRef.isReady()) {
    (navigationRef.navigate as any)(name, params);
  } else {
    setTimeout(() => {
      (navigationRef.navigate as any)(name, params);
    }, 0);
  }
}

之后在任意页面组件中,或者甚至是在普通的工具函数里,直接调用 navigate('Profile', { userId: '1001' }) 就可以完成跳转,完全不需要依赖组件内的 useNavigation 钩子。

五、常见问题排查

1、报错 "Cannot find module"

确保你的文件扩展名是 .tsx (如果包含 JSX )或 .ts (纯逻辑)。确保 tsconfig.json 中的 include 路径覆盖了你的文件。

2、iOS 构建失败‌

如果是新初始化的项目,务必先执行 cd ios && pod install && cd ..。如果之前运行过,尝试清理缓存

bash 复制代码
cd ios
pod deintegrate
pod install
cd ..
npm start -- --reset-cache

3、**报错 "Invariant Violation: Tried to register two views with the same name RNSFullWindowOverlay"**‌:

这通常是因为 react-native-screens 版本冲突或 Pods 未正确安装。请尝试:

bash 复制代码
cd ios
pod deintegrate
pod install
cd ..
npm start -- --reset-cache

4、TypeScript 类型错误但不影响运行

React Native 使用 Babel 进行编译,Babel 会剥离类型注解。因此,即使 TS 报错,应用可能仍能运行。建议使用 VS Code 编辑器,它会实时显示 TS 错误,帮助你修正代码。你可以运行 npx tsc --noEmit 来专门检查类型错误而不生成文件。‌

5、**TypeScript 报错 "Cannot find module '@react-navigation/native'"**‌

确保你已经运行了 npm install ,并且 VS Code 的 TypeScript 服务器已重启(可以在 VS Code 命令面板中执行 "TypeScript: Restart TS Server")。

6、关于 createStackNavigator 和 createNativeStackNavigator

  • createStackNavigator:纯 JS 实现,兼容性好,但动画性能稍弱。
  • createNativeStackNavigator (推荐):利用 iOS 的 UINavigationController 和 Android 的原生组件,性能更好,动画更流畅。上面的教程使用的是**native-stack**,这是目前的新标准。

7、页面报错

Uncaught Error: Requiring unknown module "766". If you are sure the module exists, try restarting Metro. You may also want to run `yarn` or `npm install`.

根本原因

react-native-screens 的原生代码没有被 CocoaPods 链接到 iOS 项目中**。** 当 JS 侧尝试 require 这些原生模块时,因为原生侧没有编译进去,Metro 的模块注册表中找不到对应的数字 ID("766"),于是报 Requiring unknown module "766"。

修复步骤

按顺序执行以下命令:

bash 复制代码
# 1. 进入 iOS 目录,安装 Pods(链接 react-native-screens 的原生代码)
cd .../RnIosDemo/ios && pod install

# 2. 回到项目根目录
cd .../RnIosDemo

# 3. 清除 Metro 缓存(防止残留的模块 ID 映射导致同样错误)
npx react-native start --reset-cache

# 4. 重新构建并运行 iOS 应用(新终端窗口)
npx react-native run-ios
为什么会这样?

React Native 0.88 使用 New Architecture(Fabric) + 自动链接 (use_native_modules!)。自动链接的原理是:pod install 时扫描 node_modules 中带有原生代码的包,自动写入 Podfile.lock 并编译。但前提是你必须跑 pod install ------单纯 npm install / yarn install 只装了 JS 代码,不会触发 CocoaPods 链接。

补充说明

如果 pod install 后仍有问题,还可以尝试:

bash 复制代码
# 清除 iOS 构建缓存
cd /Users/dxw/S/ReactNative/MyIOSProject/ios
rm -rf build
rm -rf Pods
rm Podfile.lock
pod install --repo-update

六、完整项目目录结构详解

  • RnIosDemo/ # 项目目录

    • android/ # Android 原生代码(本文以 iOS 侧为例,可以先不管)

    • iOS/ # iOS 原生工程目录(重点)

      • RnIosDemo.xcodeproj # Xcode项目文件,双击用Xcode打开

      • RnIosDemo/ # iOS原生代码(AppDelegate、Info.plist等)

      • Podfile # CocoaPods依赖配置文件

    • src/ # 主要工作区域(重点)

      • screens/ # 页面级组件(每个页面一个组件)

        • Entrance.tsx # 项目入口主页

        • Profile.js # 我的页面

      • components/ # 项目公共组件库

      • navigation/ # 路由导航配置(页面跳转)

        • index.ts # 导航栈配置
      • assets/ # 静态资源(图片、字体、图标等)

      • utils/ # 工具函数

      • services/ # 服务请求(API接口、认证)

      • types

        • navigation.ts
    • App.tsx # 应用根组件

    • index.js # JS入口文件,注册根组件到原生(一般不用改)

    • app.json # 应用名称配置(显示在桌面的名字)

    • package.json # npm 依赖管理,类似 React 的 package.json

    • babel.config.js # Babel 编译配置

    • metro.config.js # Metro 打包工具配置(RN 打包器,相当于 webpack)

    • node_modules/ # 依赖包目录,npm install 之后生成

重点说明(小白必看):

  1. ios/ 文件夹:这是真正的iOS原生工程,你需要在Xcode中配置签名、权限、启动图等,日常JS开发不常改。

  2. src/ 文件夹:90%的开发工作都在这里,和你写React Web项目非常像。

  3. 和React Web的区别:RN 没有div、span、p这些HTML标签,用的是View(对应div)、Text(对应span/p)、Image(对应img)、ScrollView(对应滚动容器)等原生组件。

相关推荐
幸运小猿12 小时前
模拟慢上传-处理超时重试image 丢失线上问题
前端·javascript·html
速易达网络14 小时前
ECharts 图表制作完全指南:从零到可视化实战
前端·javascript·echarts
paopaokaka_luck15 小时前
灾害应急物资管理系统(AI应急助手、Echarts可视化数据看板、捐赠入库联动、 物资全流程管理、库存变动追溯、灾情资讯与互动反馈、物资发放公示)
java·前端·javascript·spring boot·mysql·tomcat·echarts
kyriewen15 小时前
我验了 7 种 sticky 失效说法:3 种根本不成立
前端·javascript·程序员
我命由我1234517 小时前
Python 实用操作 - 文件操作(打开与关闭文件、读取文件、文件写入)
java·开发语言·前端·javascript·数据库·python·java-ee
大龄秃头程序员17 小时前
从源码里看懂 React Native 新架构:TurboModule 与 Fabric 到底是怎么跑起来的?
react native
Momo__17 小时前
你写的 import 重试,从来没生效过
前端·javascript·typescript
tryCbest18 小时前
Vue3——第 11 篇:组合式 API(上)——setup 与响应式 API 深度解析
前端·javascript·vue.js
tryCbest19 小时前
Vue3——第 13 篇:计算属性与侦听器——computed 与 watch 的进化
前端·javascript·vue.js