小编Too*_*oon的帖子

React-Native获取XML数据

我是React-Native的新手.试着制作一些非常简单的应用程序.无法弄清楚如何获取XML数据.使用JSON,一切都清晰简单.

但是如何获取XML?试图通过这个和其他类似的脚本将其转换为JSON ,但没有任何成功.需要帮忙 :/

我的代码看起来很简单:

var xml_url = 'http://api.example.com/public/all.xml';

var ExampleProject = React.createClass({
    getInitialState: function() {
    return {
      data: {results:{}},
    };
  },
  componentDidMount: function() {
    this.fetchData();
  },
  fetchData: function() {
    fetch(xml_url)
      .then((response) => response.json())
      .then((responseData) => {
        this.setState({
          data: responseData.data,
        });
      })
      .done();
  },

  render: function() {
    return (
      <View style={styles.wrapper}>
        <View style={styles.container}>
          <View style={styles.box}>
            <Text style={styles.heading}>Heading</Text>
            <Text>Some text</Text>
          </View>
        </View>
      </View>
    );
  },
});
Run Code Online (Sandbox Code Playgroud)

javascript xml json reactjs react-native

22
推荐指数
2
解决办法
2万
查看次数

分析实验动态网址

我有很多这样的产品页面:

www.example.com/catalog001/item123
www.example.com/catalog002/item321
www.example.com/catalog002/item567
Run Code Online (Sandbox Code Playgroud)

每个目录和产品(项目)都有自己的数字 ID。

产品页面类似。只是不同的产品图片,价格,标题。

我尝试使用正则表达式在 Analytics Experiments 中设置原始 url 模式:

www.example.com/catalog(\d+)?/item(\d+)?
Run Code Online (Sandbox Code Playgroud)

有没有办法设置原始网址模式?

google-analytics ab-testing abtest google-experiments

2
推荐指数
1
解决办法
859
查看次数