vue-apollo-decorator
Vue Apollo Decorator
Install
npm i vue-apollo-decorator
Usage
There is currently 1 decorator.
@SmartQuery(options: DocumentNode | QueryComponentProperty) decorator
import gql from 'graphql-tag';
import { SmartQuery } from 'vue-apollo-decorator';
import { Vue, Component } from 'vue-property-decorator';
@Component
export default class YourComponent extends Vue {
@SmartQuery(gql`{ todo { id, title, ... } }`) todo: Todo;
// OR
@SmartQuery<YourComponent, Todo.Query, Todo.Variables>({
query: gql`
query Todo($id: String!) {
todo(id: $id) { id, title, ... }
}`,
variables() {
return { id: '...' };
}
})
todo: Todo;
}
is equivalent to
export default {
apollo: {
todo: {
query: gql`
query Todo($id: String!) {
todo(id: $id) { id, title, ... }
}`,
variables() {
return { id: '...' };
}
}
}
};
License
MIT License
Related Packages
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.11.3 | ^2.6.x | MIT | |
| 0.11.2 | ^2.6.x | MIT | |
| 0.11.1 | ^2.6.x | MIT | |
| 0.11.0 | ^2.6.x | MIT | |
| 0.10.0 | ^2.6.x | MIT | |
| 0.9.0 | ^2.6.x | MIT | |
| 0.8.0 | ^2.6.x | MIT | |
| 0.7.0 | ^2.6.x | MIT | |
| 0.6.0 | ^2.6.x | MIT | |
| 0.5.0 | ^2.6.x | MIT | |
| 0.4.0 | ^2.6.x | MIT | |
| 0.3.0 | ^2.6.x | MIT | |
| 0.2.0 | ^2.6.x | MIT | |
| 0.1.2 | ^2.5.x | MIT | |
| 0.1.1 | ^2.5.x | MIT | |
| 0.1.0 | ^2.5.x | MIT |
Pre-releases (2)
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.0-beta.1 | ^2.6.x | MIT | |
| 1.0.0-beta.0 | ^2.6.x | MIT |