index.js 646 字节
Newer Older
DCloud_JSON's avatar
DCloud_JSON 已提交
1 2 3 4
import init from './init/index.js';
import methods from './methods/index.js';
import state from './state/index.js';
import utils from './utils/index.js';
5
import ext from './ext/index.js';
DCloud_JSON's avatar
DCloud_JSON 已提交
6

7
const uniIm = utils.deepAssign(state,methods,{init,utils},ext,{
DCloud_JSON's avatar
DCloud_JSON 已提交
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
  mapState(keys = []) {
    let obj = {}
    keys.forEach((key) => {
      let keyName = key,
        keyCName = false
      if (key.includes(' as ')) {
        let _key = key.trim().split(' as ')
        keyName = _key[0]
        keyCName = _key[1]
      }
      obj[keyCName || keyName] = function () {
        return state[keyName]
      }
    })
    return obj
  }
24 25 26
})

export default uniIm