Former-commit-id: f478b02e16eb494d784689c460829fbbe71ddebe [formerly f478b02e16eb494d784689c460829fbbe71ddebe [formerly f478b02e16eb494d784689c460829fbbe71ddebe [formerly f478b02e16eb494d784689c460829fbbe71ddebe [formerly 4261ac15c7b2142ac5c33ee050e5318f26287db5 [formerly 7e88c45dd2435fe013a5d9d2cda40466b41d8a0f]]]]] Former-commit-id: 45719bed3d7157377fa23fcaee1fb5663246e65d Former-commit-id: 3af484d24d723bf778717c99a7ed2661d6a067eb Former-commit-id: 4a025df5f087d3accb56bb7d2aeaaa16d130c2f6 [formerly f39e32c34b1b25571c16d239104d2803f4293a26] Former-commit-id: 6485639ed635c32e1c2112a8487ce9e9a4445c9b Former-commit-id: 72305626fef59076904e678d0fd82b71cc719475 Former-commit-id: f5c54ba04475494eb6135e7782b8ce879d5b96aa Former-commit-id: 85f56f5c77e07bf7cd5b910c964805a958f3050d Former-commit-id: cdf29eccd3691cf03c334b9174bd3a1c95c9b2eb
48 lines
1.1 KiB
Vue
48 lines
1.1 KiB
Vue
<template>
|
|
<d2-container type="ghost">
|
|
<el-card shadow="never" class="d2-mb">
|
|
<d2-demo-page-header slot="header" title="数据占位符"/>
|
|
<d2-markdown :source="doc"/>
|
|
</el-card>
|
|
<d2-demo-mock-card
|
|
v-for="(item, index) in settingDPD"
|
|
:key="index"
|
|
:title="item.title"
|
|
:code="JSON.stringify(item.json, null, 2)"
|
|
:mock="mockResult[index]"
|
|
@reload="doMock(index)">
|
|
</d2-demo-mock-card>
|
|
</d2-container>
|
|
</template>
|
|
|
|
<script>
|
|
import Vue from 'vue'
|
|
import _clonedeep from 'lodash.clonedeep'
|
|
import Mock from 'mockjs'
|
|
import settingDPD from './data/settingDPD'
|
|
import doc from './md/doc.md'
|
|
export default {
|
|
components: {
|
|
'd2-demo-mock-card': () => import('./components/d2-demo-mock-card')
|
|
},
|
|
data () {
|
|
return {
|
|
mockResult: [],
|
|
settingDPD,
|
|
settingDPDClone: _clonedeep(settingDPD),
|
|
doc
|
|
}
|
|
},
|
|
mounted () {
|
|
this.settingDPD.forEach((e, i) => {
|
|
this.doMock(i)
|
|
})
|
|
},
|
|
methods: {
|
|
doMock (n = 0) {
|
|
Vue.set(this.mockResult, n, JSON.stringify(Mock.mock(this.settingDPDClone[n].json), null, 2))
|
|
}
|
|
}
|
|
}
|
|
</script>
|