【发布时间】:2021-03-07 22:22:33
【问题描述】:
graphQL 和 apollo 没问题。
打字稿AllColors.ts是:
import gql from 'graphql-tag'
export const ALL_COLORS = gql`
query allColors {
allColors {
primary
secondary
}
}
`
我在plugin/vuetify.ts 中试过这个,但不会走路。
import Vue from 'vue';
import Vuetify from 'vuetify/lib/framework';
import colors from 'vuetify/lib/util/colors';
import { ALL_COLORS } from '@/graphql/AllColors'
Vue.use(Vuetify);
export default new Vuetify({
data() {
return {
allColors: []
}
},
theme: {
themes: {
dark: {
primary: this.allColors.primary,
secondary: this.allColors.secondary
},
},
},
apollo: {
allColors: {
query: ALL_COLORS
}
}
});
给出这个错误:
DONE Compiled successfully in 240ms 12:54:25
Type checking in progress...
App running at:
- Local: http://localhost:8080/
- Network: http://192.168.0.102:8080/
ERROR in /home/user1/sites/app1/src/plugins/vuetify.ts(24,19):
26:19 Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
24 | primary: this.allColors.primary,
| ^
25 | secondary: this.allColors.secondary
26 | },
27 | },
28 | },
ERROR in /home/user1/sites/app1/src/plugins/vuetify.ts(25,21):
26:19 Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
24 | primary: this.allColors.primary,
25 | secondary: this.allColors.secondary
| ^
26 | },
27 | },
28 | },
Version: typescript 3.9.7
Time: 313ms
有什么想法吗?
【问题讨论】:
标签: vue.js vuetify.js