Skip to content

Commit

Permalink
feat: wujie dom support style props (#375)
Browse files Browse the repository at this point in the history
Co-authored-by: 初放 <chufang@dian.so>
  • Loading branch information
sauron0914 and 初放 authored Mar 14, 2023
1 parent 0956b8f commit 3e72e68
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/wujie-react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export default class WujieReact extends React.PureComponent {
render() {
this.execStartApp();

const { width, height } = this.props;
const { width, height, style } = this.props;
const { myRef: ref } = this.state;
return <div style={{ width, height }} ref={ref} />;
return <div style={{ width, height, ...style }} ref={ref} />;
}
}

Expand Down Expand Up @@ -67,4 +67,5 @@ const propTypes = {
activated: PropTypes.func,
deactivated: PropTypes.func,
loadError: PropTypes.func,
style: PropTypes.object
}
3 changes: 3 additions & 0 deletions packages/wujie-vue2/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Vue from "vue";
import { bus, preloadApp, startApp as rawStartApp, destroyApp, setupApp } from "wujie";
import CSS from 'csstype'

const wujieVueOptions = {
name: "WujieVue",
Expand Down Expand Up @@ -27,6 +28,7 @@ const wujieVueOptions = {
activated: { type: Function, default: null },
deactivated: { type: Function, default: null },
loadError: { type: Function, default: null },
style: { type: CSS.Properties, default: {} },
},
data() {
return {
Expand Down Expand Up @@ -91,6 +93,7 @@ const wujieVueOptions = {
style: {
width: this.width,
height: this.height,
...this.style,
},
ref: "wujie",
});
Expand Down
3 changes: 3 additions & 0 deletions packages/wujie-vue3/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { bus, preloadApp, startApp as rawStartApp, destroyApp, setupApp } from "wujie";
import { h, defineComponent } from "vue";
import CSS from 'csstype'

const wujieVueOptions = {
name: "WujieVue",
Expand Down Expand Up @@ -27,6 +28,7 @@ const wujieVueOptions = {
activated: { type: Function, default: null },
deactivated: { type: Function, default: null },
loadError: { type: Function, default: null },
style: { type: CSS.Properties, default: {} },
},
data() {
return {
Expand Down Expand Up @@ -90,6 +92,7 @@ const wujieVueOptions = {
style: {
width: this.width,
height: this.height,
...this.style,
},
ref: "wujie",
});
Expand Down

0 comments on commit 3e72e68

Please sign in to comment.