Comments (8)
目前官网提到的方法,都是通过最外层的父组件修改子组件的内容,通过this.sub.option即可。可是反过来,如果由于子组件的内容修改了,需要修改父组件或者兄弟组件的时候如何实现?knockout就提供了$root或者$parent的方式来更改其内容。
from omi.
@louisscrew
两种方式:
1.option里注册callback,callback会在子组件里执行。callback想干嘛就干嘛
2. 子组件里使用代码: this._nuclearParent.option.title = "abc";
推荐第一种,这种组件耦合度低。
from omi.
1.option里注册callback,callback会在子组件里执行。callback想干嘛就干嘛
请问这个callback,如何在option注册?能否给出一个demo,谢谢。
from omi.
from omi.
this.childrenOptions = [
{
},
{
aa: xx,
onClick: function () {
},
xxxHandler:function(){
}
}]
from omi.
- 子组件里使用代码: this._nuclearParent.option.title = "abc";
在子组件中没有获取到_nuclearParent这个对象啊,这个对象是undefined
from omi.
from omi.
@louisscrew
使用nuclearParent,没有下划线。注意:0.5.2版本。
非常感谢。
from omi.
Related Issues (20)
- effect is running for every dependecy HOT 1
- [omi-templates]完成调查问卷页的黑夜模式的适配
- [omi-templates]页面滚动自动切换右边的导航active项
- 由于某些原因,我们需要 cdn 引入 omi, 请问怎么配置? HOT 1
- 需要支持这个嵌入fragment,不需要flat
- 使用OMI实现TDesign风格-企业官网模板 HOT 2
- 使用OMI实现TDesign风格-电子商务模板 HOT 3
- 使用OMI实现TDesign风格-个人博客模板 HOT 1
- 使用OMI实现TDesign风格-组合/作品集模板 HOT 4
- 使用OMI实现TDesign风格-教育/课程模板 HOT 1
- 使用OMI实现TDesign风格-餐厅/美食模板 HOT 1
- 使用OMI实现TDesign风格-活动/会议模板 HOT 3
- 使用OMI实现TDesign风格-非营利组织/慈善模板 HOT 1
- 使用OMI实现TDesign风格-论坛/社区模板 HOT 2
- 使用OMI实现TDesign风格-新闻/杂志模板 HOT 1
- 如何使用omi 进行维修小程序开发? HOT 1
- 打包之后,props失效 HOT 2
- 使用tag注册组件不警告类型警告或者错误
- 是否可以开一个omi-low-code的分支仓库
- Effect duplicating bug HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from omi.