no message
Former-commit-id: 0a96bb54e9270e451e59b72e00e35053a7c0e152 Former-commit-id: c250ba90da6546626b9831847630aae786c88344 Former-commit-id: c1182b1bdc6ea9b3934275286a93e2760a643bfe
This commit is contained in:
30
src/pages/demo/plugins/mock/mixins/function.js
Normal file
30
src/pages/demo/plugins/mock/mixins/function.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/* eslint-disable */
|
||||
import Mock from 'mockjs'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
// 测试函数
|
||||
fn: {
|
||||
title: '函数',
|
||||
code: `{
|
||||
"name": "FairyEver",
|
||||
"say": function() {
|
||||
return 'I AM ' + this.name
|
||||
}
|
||||
}`,
|
||||
json: {
|
||||
"name": "FairyEver",
|
||||
"say": function() {
|
||||
return 'I AM ' + this.name
|
||||
}
|
||||
},
|
||||
mocked: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fnMock () {
|
||||
this.fn.mocked = JSON.stringify(Mock.mock(this.fn.json), null, 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
28
src/pages/demo/plugins/mock/mixins/regexp.js
Normal file
28
src/pages/demo/plugins/mock/mixins/regexp.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/* eslint-disable */
|
||||
import Mock from 'mockjs'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
// 测试正则表达式
|
||||
regexp: {
|
||||
title: '正则表达式',
|
||||
code: `{
|
||||
'regexp1': /[a-z][A-Z][0-9]/,
|
||||
'regexp2': /\w\W\s\S\d\D/,
|
||||
'regexp3': /\d{5,10}/
|
||||
}`,
|
||||
json: {
|
||||
'regexp1': /[a-z][A-Z][0-9]/,
|
||||
'regexp2': /\w\W\s\S\d\D/,
|
||||
'regexp3': /\d{5,10}/
|
||||
},
|
||||
mocked: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
regexpMock () {
|
||||
this.regexp.mocked = JSON.stringify(Mock.mock(this.regexp.json), null, 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user