wechat-miniprogram / wechat-miniprogram/api-typings
组件中this.data提示不存在
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 803
- Forks
- 117
- Avg merge
- 24m
- Merged PRs (30d)
- 1
Description
#169 已经关闭,但是类似的复现如下
index.ts
methods: {
onChange(e: { detail: { value: any; }; }) {
this.setData({ value: e.detail.value }); // ts(2339) 报错
},
handleChange(e) {
this.setData({ // ts(2339) 报错
activeValues: e.detail.value,
});
},
},
lifetimes: {
attached() {
}
},
eslintrc.js
/*
* Eslint config file
* Documentation: https://eslint.org/docs/user-guide/configuring/
* Install the Eslint extension before using this feature.
*/
module.exports = {
env: {
es6: true,
browser: true,
node: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
// extends: 'eslint:recommended',
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
rules: {
semi: ['error', 'never']
},
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduced component code in index.ts and verify the ts(2339) errors for this.setData inside methods and lifetimes. Compare the component typing behavior with the examples in issue #169; done means the shown callbacks type-check without reporting that setData is missing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100