小编May*_*yer的帖子

观察者内部 Vue 类组件装饰器的访问方法

本质上,我在 Github 上有与此问题相同的问题,不幸的是,它们在得到答复之前都已关闭:/

我将 Vue 与 Typscript 和 Vue 类组件一起使用。我需要做的是从 @Component 装饰器内的观察者内部访问我的(Vue-)类的方法。我知道可以使用 访问组件的数据this.$data,但是方法呢?

我的代码可以在运行时运行,但会在 vscode 中产生编译时错误和错误(“属性‘clearInfo’在类型‘Vue’上不存在。”);

@Component({
  watch: {
    firstMesh(newMesh) {
      if (newMesh === undefined) this.clearInfo(1);   // this produces the errors
      else this.showMeshInfo(newMesh, 1);
    },
    secondMesh(newMesh) {
      if (newMesh === undefined) this.clearInfo(2);
      else this.showMeshInfo(newMesh, 2);
    },
  },
})


export default class Info extends Vue {
  clearInfo(whichMesh : number) {
...
  }

  showMeshInfo(mesh : any, index : number) {
    ....
  }


}
Run Code Online (Sandbox Code Playgroud)

javascript typescript vue.js vue-class-components

4
推荐指数
1
解决办法
5096
查看次数

AWS 使用 Node.js SDK 调用本地 Lambda 端点

SAM 文档中,可以部署您自己的 lambda 端点并使用 Python SDK 调用它。

您只需启动本地 lambda 端点sam local start-lambda,然后继续

# USING AWS SDK
 -------------
 #You can also use the AWS SDK in your automated tests to invoke your functions programatically.
 #Here is a Python example:

     self.lambda_client = boto3.client('lambda',
                                  endpoint_url="http://127.0.0.1:3001",
                                  use_ssl=False,
                                  verify=False,
                                 config=Config(signature_version=UNSIGNED,
                                               read_timeout=0,
                                                retries={'max_attempts': 0}))
    self.lambda_client.invoke(FunctionName="HelloWorldFunction")
Run Code Online (Sandbox Code Playgroud)

我现在的问题是,我怎样才能用 Javascript SDK 做同样的事情?我总是收到有关缺少区域、未找到主机和不受支持的参数的不同错误。你有办法帮我解决吗?

javascript amazon-web-services node.js aws-lambda serverless-application-model

1
推荐指数
1
解决办法
3234
查看次数