mirror of https://github.com/vuejs/vue.git
fix(types): support string type for style in VNode data (#9728)
fix #9727
This commit is contained in:
parent
653c74e64e
commit
982d5a492f
|
@ -42,7 +42,7 @@ declare interface VNodeData {
|
||||||
staticClass?: string;
|
staticClass?: string;
|
||||||
class?: any;
|
class?: any;
|
||||||
staticStyle?: { [key: string]: any };
|
staticStyle?: { [key: string]: any };
|
||||||
style?: Array<Object> | Object;
|
style?: string | Array<Object> | Object;
|
||||||
normalizedStyle?: Object;
|
normalizedStyle?: Object;
|
||||||
props?: { [key: string]: any };
|
props?: { [key: string]: any };
|
||||||
attrs?: { [key: string]: string };
|
attrs?: { [key: string]: string };
|
||||||
|
|
|
@ -213,3 +213,28 @@ class Decorated extends Vue {
|
||||||
|
|
||||||
const obj = Vue.observable({ a: 1 })
|
const obj = Vue.observable({ a: 1 })
|
||||||
obj.a++
|
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
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
@ -48,7 +48,7 @@ export interface VNodeData {
|
||||||
staticClass?: string;
|
staticClass?: string;
|
||||||
class?: any;
|
class?: any;
|
||||||
staticStyle?: { [key: string]: any };
|
staticStyle?: { [key: string]: any };
|
||||||
style?: object[] | object;
|
style?: string | object[] | object;
|
||||||
props?: { [key: string]: any };
|
props?: { [key: string]: any };
|
||||||
attrs?: { [key: string]: any };
|
attrs?: { [key: string]: any };
|
||||||
domProps?: { [key: string]: any };
|
domProps?: { [key: string]: any };
|
||||||
|
|
Loading…
Reference in New Issue