Comments (13)
context 的 api 目前不是很明确,还需要等尤大给出更具体的 api 才可以实现。
from vue-function-api.
@liximomo 是否可以考虑按照现有的范例将现有api的this包装成context呢?
from vue-function-api.
from vue-function-api.
Context是不没有导出,
使用context也是无法正常使用的
console.log(context)
也都是这样的,都是undefined
from vue-function-api.
为什么需要导出Context?
from vue-function-api.
from vue-function-api.
setup(props, context)
就足够了,可以自动推导出 context 的类型。
from vue-function-api.
setup(props, context) {
const handleClick = () => {
context.emit('send')
}
// watch
return {
handleClick
}
}
目前这样写是会无法使用的,
会报错
[Vue warn]: Error in v-on handler: "TypeError: context.emit is not a function"
版本2.0.4
from vue-function-api.
鼠标悬停 context
然我看看提示的是什么类型?
from vue-function-api.
类型是Context,也能输出,但是里面的字属性是undefined
console.log(context) 如下:
from vue-function-api.
这和类型没关系,这是因为值没有正确被代理到 context. 我修复一下
from vue-function-api.
@pangao66 升级到 2.0.5
from vue-function-api.
非常感谢
from vue-function-api.
Related Issues (9)
- TypeError: Cannot read property 'refs' of undefined HOT 1
- SFC support HOT 2
- We would love to adopt this package! HOT 4
- English README HOT 1
- README.md 文件錯誤 HOT 1
- 目前不能很好是与vue-devtools结合 HOT 2
- value(null) will error out HOT 2
- 对于ts来说,是不是少了 createComponent 包装器? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-function-api.