diff --git a/flow/vnode.js b/flow/vnode.js index 0521b33c..c9f3b388 100644 --- a/flow/vnode.js +++ b/flow/vnode.js @@ -42,7 +42,7 @@ declare interface VNodeData { staticClass?: string; class?: any; staticStyle?: { [key: string]: any }; - style?: Array | Object; + style?: string | Array | Object; normalizedStyle?: Object; props?: { [key: string]: any }; attrs?: { [key: string]: string }; diff --git a/types/test/vue-test.ts b/types/test/vue-test.ts index ca04e847..626220d0 100644 --- a/types/test/vue-test.ts +++ b/types/test/vue-test.ts @@ -213,3 +213,28 @@ class Decorated extends Vue { const obj = Vue.observable({ a: 1 }) obj.a++ + +// VNodeData style tests. +const ComponentWithStyleInVNodeData = Vue.extend({ + render (h) { + const elementWithStyleAsString = h('div', { + style: 'background-color: red;' + }); + + const elementWithStyleAsObject = h('div', { + style: { backgroundColor: 'green' } + }); + + const elementWithStyleAsArrayOfObjects = h('div', { + style: [ + { backgroundColor: 'blue' } + ] + }); + + return h('div', undefined, [ + elementWithStyleAsString, + elementWithStyleAsObject, + elementWithStyleAsArrayOfObjects + ]); + } +}); diff --git a/types/vnode.d.ts b/types/vnode.d.ts index 62afcfeb..dc4470ff 100644 --- a/types/vnode.d.ts +++ b/types/vnode.d.ts @@ -48,7 +48,7 @@ export interface VNodeData { staticClass?: string; class?: any; staticStyle?: { [key: string]: any }; - style?: object[] | object; + style?: string | object[] | object; props?: { [key: string]: any }; attrs?: { [key: string]: any }; domProps?: { [key: string]: any };