1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { MDViewController } from '@ibiz-template/controller';
import { defineComponent, PropType } from 'vue';
export const MDViewBase = defineComponent({
props: {
controller: {
type: Object as PropType<MDViewController>,
required: true,
},
},
setup() {
return {};
},
render() {
const c = this.controller;
// 外面的插槽同样传给view-layout
const inheritSlots: IData = {};
Object.keys(this.$scopedSlots).forEach(key => {
inheritSlots[key] = (arg: IData) => this.$scopedSlots[key]!(arg);
});
return (
<view-base
controller={c}
scopedSlots={{
quickSearch: () => {
if (c.complete && c.model.source.enableQuickSearch) {
return (
<quick-search
value={c.query}
viewMode={c.modal.mode}
placeholder={c.model.placeholder}
on-update={(val: string) => {
c.query = val;
}}
on-search={() => c.onSearch()}
></quick-search>
);
}
},
searchForm: () => {
if (c.complete && c.model.searchForm) {
return (
<search-form-control
v-show={c.showSearchForm}
modelData={c.model.searchForm}
context={c.context}
params={c.params}
on-neuronInit={c.nerve.onNeuronInit(
c.model.searchForm.source.name,
)}
></search-form-control>
);
}
},
...inheritSlots,
}}
/>
);
},
});