-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from wu-component/featue/test
fix:fix inject params bug
- Loading branch information
Showing
10 changed files
with
116 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { h, Component, Inject, OnConnected } from '@canyuegongzi/web-core-plus'; | ||
|
||
@Component({ | ||
name: 'wu-plus-inject-child1', | ||
}) | ||
export class WuInjectChild1 extends HTMLElement implements OnConnected { | ||
@Inject('parentDescTitle') | ||
public injectionName; | ||
|
||
public connected(shadowRoot: ShadowRoot) { | ||
console.log(this.injectionName); | ||
} | ||
|
||
public render(_renderProps = {}, _store = {}) { | ||
return ( | ||
<div style={{ width: '400px', height: '48px', textAlign: 'center' }}> | ||
一级子组件数据注入{this.injectionName?.parentDescTitle} | ||
<slot /> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { h, Component, Inject, OnConnected } from '@canyuegongzi/web-core-plus'; | ||
|
||
@Component({ | ||
name: 'wu-plus-inject-child2', | ||
}) | ||
export class WuInjectChild2 extends HTMLElement implements OnConnected { | ||
@Inject('parentDescTitle') | ||
public injectionName; | ||
|
||
public connected(shadowRoot: ShadowRoot) { | ||
console.log(this.injectionName); | ||
} | ||
|
||
public render(_renderProps = {}, _store = {}) { | ||
return ( | ||
<div style={{ width: '400px', height: '48px', textAlign: 'center' }}> | ||
二级子组件数据注入{this.injectionName?.parentDescTitle} | ||
<slot /> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { h, Component, Inject, OnConnected } from '@canyuegongzi/web-core-plus'; | ||
|
||
@Component({ | ||
name: 'wu-plus-inject', | ||
}) | ||
export class WuInject extends HTMLElement implements OnConnected { | ||
@Inject('parentDescTitle') | ||
public injectionName; | ||
|
||
public connected(shadowRoot: ShadowRoot) { | ||
console.log(this.injectionName); | ||
} | ||
|
||
public render(_renderProps = {}, _store = {}) { | ||
return <div style={{ width: '100vw', height: '48px', textAlign: 'center' }}>数据注入{this.injectionName?.parentDescTitle}</div>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Component, h, Method, OnConnected, Provide } from '@canyuegongzi/web-core-plus'; | ||
|
||
@Component({ | ||
name: 'wu-plus-provide', | ||
}) | ||
export class WuProvide extends HTMLElement implements OnConnected { | ||
public provide = '这是来自父级注入的数据'; | ||
|
||
@Provide('parentDescTitle') | ||
public provideParentDescTitle() { | ||
return { | ||
parentDescTitle: this.provide, | ||
}; | ||
} | ||
|
||
/** | ||
* 获取 | ||
* @private | ||
*/ | ||
@Method() | ||
public getProvide() { | ||
return this.provide; | ||
} | ||
|
||
public render(_renderProps = {}, _store = {}) { | ||
return <slot />; | ||
} | ||
|
||
public connected(shadowRoot: ShadowRoot): any {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters