Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在Vue本机方法中返回React本机组件_Javascript_React Native_Vue.js_Vue Native - Fatal编程技术网

Javascript 如何在Vue本机方法中返回React本机组件

Javascript 如何在Vue本机方法中返回React本机组件,javascript,react-native,vue.js,vue-native,Javascript,React Native,Vue.js,Vue Native,我使用Vue Native编写应用程序,在我的例子中,我使用React Native组件,该组件使用prop函数renderItem返回React Native元素(例如) 我有Vue元素wineCard,我应该在这个函数中返回它 在React中,此函数如下所示: renderItem = ({ item, index, move, moveEnd, isActive }) => { return ( <TouchableOpacity onL

我使用Vue Native编写应用程序,在我的例子中,我使用React Native组件,该组件使用prop函数
renderItem
返回React Native元素(例如

我有Vue元素
wineCard
,我应该在这个函数中返回它

在React中,此函数如下所示:

  renderItem = ({ item, index, move, moveEnd, isActive }) => {
    return (
      <TouchableOpacity
        onLongPress={move}
        onPressOut={moveEnd}
      >
      <wineCard wineItem={item} />
      </TouchableOpacity>
    )
  }
renderItem=({item,index,move,moveEnd,isActive})=>{
返回(
)
}

如何使用Vue Native执行此操作?

您可以在Vue Native中返回React Native组件,方法是创建一个包含React Native组件的
.js
文件,并将其放在Vue Native应用程序的组件目录中

例如:

组件/flex.js:

import React, { Component } from 'react';
import { View } from 'react-native';

export default class FlexDirectionBasics extends Component {
  render() {
    return (
      // Try setting `flexDirection` to `column`.
      <View style={{flex: 1, flexDirection: 'row'}}>
        <View style={{width: 50, height: 50, backgroundColor: 'powderblue'}} />
        <View style={{width: 50, height: 50, backgroundColor: 'skyblue'}} />
        <View style={{width: 50, height: 50, backgroundColor: 'steelblue'}} />
      </View>
    );
  }
};
import React,{Component}来自'React';
从“react native”导入{View};
导出默认类FlexDirectionBasics扩展组件{
render(){
返回(
//尝试将“flexDirection”设置为“column”。
);
}
};
Views/Home.Vue:

<template>
  <view>
    <Flex/>>
  </view>
</template>
 <script>
  import Flex from '.././Components/flex.js'

  export default {
    components:{Flex}
  }
</script>

>
从“.././Components/Flex.js”导入Flex
导出默认值{
组件:{Flex}
}