静态方法不起作用

时间:2019-10-25 19:51:15

标签: javascript node.js

我创建的班级有所改变。此类中的方法应该是静态的,但是我在调​​用它时遇到问题。

class Rating {
  static changeRating ( leftRating,rightRating){
    return(leftRating+rightRating);
 }
} 

在另一个文件中,我有

import { User, Team } from '../../models'
import mongoose from 'mongoose'
import { UserInputError, ApolloError } from 'apollo-server-core';
import Joi from 'joi'
import * as Validator from '../../validation'
import * as Config from '../../config'
import * as Rating from '../../rating'
export default {
Mutation:{
 changeRating: async (root, args, { req }, info) => {
        console.log(Rating.changeRating(1255,1244))
 }
}
}

然后我得到

"Rating.changeRating is not a function."

我想要个数字,这个数字当然会在将来更改。

0 个答案:

没有答案