MCPcopy
hub / github.com/xuhuai66/used-book-pro / VantComponent

Function VantComponent

miniprogram/vant/common/component.js:10–47  ·  view source on GitHub ↗
(vantOptions = {})

Source from the content-addressed store, hash-verified

8 });
9}
10function VantComponent(vantOptions = {}) {
11 const options = {};
12 mapKeys(vantOptions, options, {
13 data: 'data',
14 props: 'properties',
15 mixins: 'behaviors',
16 methods: 'methods',
17 beforeCreate: 'created',
18 created: 'attached',
19 mounted: 'ready',
20 relations: 'relations',
21 destroyed: 'detached',
22 classes: 'externalClasses'
23 });
24 const { relation } = vantOptions;
25 if (relation) {
26 options.relations = Object.assign(options.relations || {}, {
27 [`../${relation.name}/index`]: relation
28 });
29 }
30 // add default externalClasses
31 options.externalClasses = options.externalClasses || [];
32 options.externalClasses.push('custom-class');
33 // add default behaviors
34 options.behaviors = options.behaviors || [];
35 options.behaviors.push(basic);
36 // map field to form-field behavior
37 if (vantOptions.field) {
38 options.behaviors.push('wx://form-field');
39 }
40 // add default options
41 options.options = {
42 multipleSlots: true,
43 addGlobalClass: true
44 };
45 observe(vantOptions, options);
46 Component(options);
47}
48export { VantComponent };

Callers 15

index.jsFile · 0.90
index.jsFile · 0.90
index.jsFile · 0.90
index.jsFile · 0.90
index.jsFile · 0.90
index.jsFile · 0.90
index.jsFile · 0.90
index.jsFile · 0.90
index.jsFile · 0.90
index.jsFile · 0.90
index.jsFile · 0.90
index.jsFile · 0.90

Calls 2

observeFunction · 0.90
mapKeysFunction · 0.85

Tested by

no test coverage detected