mirror of
https://github.com/YMFE/yapi.git
synced 2025-03-01 14:05:44 +08:00
feat: add default resParams reqParams
This commit is contained in:
parent
ff06fdb3f8
commit
d8d44560ae
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user