PageSourceSearch

https://www.ry-elerelay.com/src/package/cell.js

js ry-elerelay.com collected 2026-10-04 04:34:38 UTC 1,569 bytes, 49 lines download raw bytes

1import Package from './package.js'
2import Unit from './unit.js'
3import HookCell from '../hooks/cell.js'
4
5class Cell extends Package {
6  /**
7   * 构造函数
8   * @param {JSON} config
9   */
10  constructor({ ctx, params, sequence, parent_attr_id, parent_hide_phone }) {
11    super({ ctx, params, type: 'cell', sequence, parent_attr_id, parent_hide_phone })
12  }
13  /** 处理接口返回的差异 */
14  initCloudData(thisPackage, isLocal) {
15    this.cols_col = thisPackage.cols_col || 12
16    this.cols_md = thisPackage.cols_md || 12
17    this.cols_xl = thisPackage.cols_xl || 12
18    this.children = (isLocal ? thisPackage.unit : null) || thisPackage.children || []
19    this.is_customize = thisPackage.is_customize || 0
20    this.generate_config = thisPackage.generate_config || {}
21    this.transfer = thisPackage.transfer || ''
22  }
23  /** 把子级都实例化 */
24  async initSelf() {
25    this.initHooks()
26    const ctx = this.getCtx()
27    let i = 0
28    this.children = this.children.map(signOrData => {
29      try {
30        const sequence = [...this.sequence]
31        sequence.push(i ++)
32        return new Unit({ ctx, params: signOrData, sequence, parent_attr_id: this.attr_id, parent_hide_phone: this.current_hide_phone || this.hide_phone })
33      } catch (err) {
34        ctx.state.error = {
35          code: err.code,
36          message: err.message,
37          stack: err.stack,
38        }
39      }
40    }).filter(item => item)
41  }
42  /** 初始化钩子函数 */
43  initHooks() {
44    const ctx = this.getCtx()
45    this.hook = new HookCell(ctx, {}, this)
46  }
47}
48
49export default Cell

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.