This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* [email protected] | |
* 2017-05-08 | |
*/ | |
'use strict'; | |
import React, { Component } from 'react'; | |
import { | |
AppRegistry, | |
StyleSheet, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import provinces from 'china-division/dist/provinces.json'; | |
import cities from 'china-division/dist/cities.json'; | |
import areas from 'china-division/dist/areas.json'; | |
areas.forEach((area) => { | |
const matchCity = cities.filter(city => city.code === area.cityCode)[0]; | |
if (matchCity) { | |
matchCity.children = matchCity.children || []; | |
matchCity.children.push({ | |
label: area.name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//类似数组[行, 列] | |
//表示起始位置为0,占据2行 | |
GridLayout.Spec rowSpec=GridLayout.spec(0, 2, GridLayout.UNDEFINED); | |
//表示起始位置为1,占据1列 | |
GridLayout.Spec columnSpec=GridLayout.spec(i, 1, GridLayout.UNDEFINED); | |
GridLayout.LayoutParams params=new GridLayout.LayoutParams(rowSpec, columnSpec); | |
gridlayout.addView(view, params); | |
此外xml中也要预先定好多少行多少列 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function(require) { | |
var React = require('react'); | |
var paramRegex = /__(\d)+/; | |
var parser = new DOMParser(); | |
var errorDoc = parser.parseFromString('INVALID', 'text/xml'); | |
var errorNs = errorDoc.getElementsByTagName("parsererror")[0].namespaceURI; | |
// turns the array of string parts into a DOM | |
// throws if the result is an invalid XML document. |