feat: add default resParams reqParams

This commit is contained in:
sean 2017-08-01 09:49:11 +08:00
parent ff06fdb3f8
commit d8d44560ae
2 changed files with 15 additions and 4 deletions

View File

@ -102,8 +102,18 @@ class AddInterface extends Component {
const props = this.props
props.pushInputValue('')
props.pushInterfaceName('')
props.getReqParams('')
props.getResParams('')
props.getReqParams(JSON.stringify({
"id": 1,
"name": "xxx"
}))
props.getResParams(JSON.stringify({
errcode: "@natural",
"data|3-8": {
uid: "@id",
name: "@name",
email: "@email"
}
}))
props.addReqHeader(initData)
}
}

View File

@ -28,7 +28,6 @@ class ResParams extends Component {
constructor(props) {
super(props)
console.log(props)
}
// initResParams () {
@ -69,7 +68,6 @@ class ResParams extends Component {
var rhymeCompleter = {
identifierRegexps: [/[@]/],
getCompletions: function (editor, session, pos, prefix, callback) {
console.log(prefix)
if (prefix.length === 0) { callback(null, []); return }
var wordList = [
{ name: '字符串', mock: '@string' },
@ -97,10 +95,13 @@ class ResParams extends Component {
}
}
langTools.addCompleter(rhymeCompleter);
editor.getSession().on('change', () => {
this.props.getResParams(editor.getValue())
});
setTimeout(() => {
editor.setValue(json_parse(this.props.resParams))
}, 400)
}