liximomo / vue-function-api Goto Github PK
View Code? Open in Web Editor NEWProvide logic composition capabilities for Vue.
Provide logic composition capabilities for Vue.
When putting null
in a value wrapper, this error will be thrown:
TypeError: "can't convert null to object"
upWrapping vue-function-api.module.js:336
value vue-function-api.module.js:353
setup CodeSandbox.vue:45
mergedSetupFn vue-function-api.module.js:273
vuexInit vue-function-api.module.js:302
Here is an example code:
import { value } from 'vue-function-api'
export default {
setup () {
return { error: value(null) }
}
}
Hello and thanks for your work.
I was wondering about the SFC support. Currently it seems there is a binding issue (Property or method "msg" is not defined on the instance but referenced during render
).
I tested with:
<template>
<h1>{{ msg }}</h1>
</template>
<script lang="ts">
import Vue from "vue";
import { value } from "vue-function-api";
export default Vue.extend({
setup() {
const msg = value("Hello World!");
return { msg };
}
});
</script>
使用这个在vue-devtools中不能正常识别data和computed
It doesn't look like the second parameter 'context' is defined. The custom hooks are irrelevant to the issue, but this is how I am using them.
This is my code:
setup(props, context) {
const message = value("Hello Vue in CodeSandbox!");
const messageUppercase = computed(() => message.value.toUpperCase());
useKeypress("j", () => {
console.log("clicked!");
});
useElementKeypress("u", context.refs.elementKeypress, () => {
console.log("clicked!");
});
return { message, messageUppercase };
}
https://github.com/vuejs/rfcs/blob/function-apis/active-rfcs/0000-function-api.md
ref,emit等, 目前能用this.xxx的写法,但是如果用ts格式是会报错的, 3.0的rfcs会传递个setup参数
props的类型推导暂未支持
如题,我记得ts时需要createComponent包装器的
Adding English README can make the project reachable for more people.
I can do some help if needed.
下方文件的部分寫
import { plugin, value, computed, watch, onMounted } from 'vue-class-component'
但是應該是
import { plugin, value, computed, watch, onMounted } from 'vue-function-api'
Hi @liximomo - thank you very much for working on this package, something we wish we had when the RFC thread blew up.
We are considering adopting this package to serve as the official 2.x function API plugin, and in the process you are welcome to join the core team. There are still a few changes to the RFC we are considering, and would love to work with you to see that reflected in this package. Would you be interested?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.