我如何在React Native中解析肥皂数据

发布于 2025-01-31 19:05:28 字数 1009 浏览 3 评论 0原文

我如何解析React Native中的肥皂数据?我需要帮助请帮助我,如果我编写console.log(channels [0]); 是输出; 只需{

视图的内容出现在屏幕上。

constructor(props) {
    super(props);
    this.state = ({
        channels: [],
    });
}

componentDidMount() {


    axios.post('xxxx', xmls, {
        headers: {
            'Content-Type': 'text/xml',
            Accept: 'application/xml',
          
        },
    })
        .then((response) => {
            const channels = convert.xml2json(response.data, {alwaysArray:true,ignoreAttributes: true, compact: true, ignoreDeclaration: true, fullTagEmptyElement: true, spaces: 4 })
            this.setState({ channels: [] })
            console.log(channels);
        })
        .catch(err => console.log(err));




}

render() {


    return (
        <View>

            {this.channels.map((v, id) => {
                <View key={id}>{v.item}</View>
            })}
       
       

        </View>
       
    )
}

}

How Can I Parse SOAP Data in React Native? I need help pls someone help me, i tried, if i write console.log(channels[0]);
is output;
just {

The contents of the view appear blank on the screen.

constructor(props) {
    super(props);
    this.state = ({
        channels: [],
    });
}

componentDidMount() {


    axios.post('xxxx', xmls, {
        headers: {
            'Content-Type': 'text/xml',
            Accept: 'application/xml',
          
        },
    })
        .then((response) => {
            const channels = convert.xml2json(response.data, {alwaysArray:true,ignoreAttributes: true, compact: true, ignoreDeclaration: true, fullTagEmptyElement: true, spaces: 4 })
            this.setState({ channels: [] })
            console.log(channels);
        })
        .catch(err => console.log(err));




}

render() {


    return (
        <View>

            {this.channels.map((v, id) => {
                <View key={id}>{v.item}</View>
            })}
       
       

        </View>
       
    )
}

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文