clrc-schema
Advanced tools
Comparing version 0.1.4 to 0.1.5
13
app.jsx
@@ -73,6 +73,4 @@ import './src/index.less'; | ||
enum: [ | ||
{ value: 11, name: '第11题'}, | ||
{ value: 11, name: '第12题'}, | ||
{ value: 11, name: '第13题'}, | ||
{ value: 11, name: '第14题'}, | ||
{ value: true, name: 'TRUE'}, | ||
{ value: false, name: 'FALSE'}, | ||
] | ||
@@ -116,2 +114,9 @@ } | ||
class APP extends Component { | ||
componentDidMount() { | ||
window._getData = () => { | ||
let data = this.refs.obj.getData(); | ||
console.log(data); | ||
}; | ||
} | ||
render() { | ||
@@ -118,0 +123,0 @@ return <div> |
@@ -43,3 +43,14 @@ 'use strict'; | ||
var inputValue = this.refs.input.value; | ||
return inputValue; | ||
var result = void 0; | ||
var schema = this.props.schema; | ||
var options = schema.enum; | ||
for (var i = options.length - 1; i >= 0; i--) { | ||
var op = options[i]; | ||
if (op.name === inputValue) { | ||
result = op.value; | ||
break; | ||
} | ||
} | ||
return result; | ||
} | ||
@@ -70,3 +81,3 @@ }, { | ||
'option', | ||
{ key: i, value: op.value }, | ||
{ key: i, value: op.name }, | ||
op.name | ||
@@ -73,0 +84,0 @@ ); |
{ | ||
"name": "clrc-schema", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "clrc schema", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -8,3 +8,13 @@ import { Component, PropTypes } from 'react'; | ||
let inputValue = this.refs.input.value; | ||
return inputValue; | ||
let result; | ||
let { schema } = this.props; | ||
let options = schema.enum; | ||
for (let i = options.length - 1; i >= 0; i--) { | ||
let op = options[i]; | ||
if(op.name === inputValue) { | ||
result = op.value; | ||
break; | ||
} | ||
} | ||
return result; | ||
} | ||
@@ -22,3 +32,3 @@ | ||
let input = <select ref="input" defaultValue={data}> | ||
{options.map((op, i) => <option key={i} value={op.value}>{op.name}</option>)} | ||
{options.map((op, i) => <option key={i} value={op.name}>{op.name}</option>)} | ||
</select>; | ||
@@ -25,0 +35,0 @@ if(inline) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1143297
25213