Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/417.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Vuejs-在导出的类上使用函数getProperties_Javascript_Ecmascript 6_Vuejs2 - Fatal编程技术网

Javascript Vuejs-在导出的类上使用函数getProperties

Javascript Vuejs-在导出的类上使用函数getProperties,javascript,ecmascript-6,vuejs2,Javascript,Ecmascript 6,Vuejs2,我有一个源模块: import _ from 'underscore' import {Observable} from 'rxjs' export default function (rxfb) { return { getProperties () { return rxfb.sources.user.getUser() .switchMap(({properties}) => properties

我有一个源模块:

import _ from 'underscore'
import {Observable} from 'rxjs'

export default function (rxfb) {
  return {
    getProperties () {
      return rxfb.sources.user.getUser()
        .switchMap(({properties}) =>
          properties
            ? Observable.combineLatest(_(properties).map((property, propertyId) =>
              this.getProperty(propertyId).map(property => ({propertyId, ...property}))))
            : Observable.from([{}]))
    }
  }
}
我需要从另一个部分访问它,因此我要导入它:

import myProperties from '../../sources/properties'
然后我尝试:

console.log(myProperties.getProperties())

但是它不起作用,访问此方法的正确方法是什么?

您正在导出一个
函数
,但您将其用作
对象

似乎您必须这样使用它(调用函数):


你能准确地告诉我你得到的GetProperties不是一个函数的错误吗?请参考:我发布了答案,如果有任何问题,请告诉我。
import myProperties from '../../sources/properties'
console.log(myProperties().getProperties())