详解angular2封装material2对话框组件
1. 说明
angular-material2自身文档不详,控件不齐,使用上造成了很大的障碍。这里提供一个方案用于封装我们最常用的alert和confirm组件。
2. 官方使用方法之alert
①编写alert内容组件
@Componen...
2017-03-13
A higher-order component that adds watch props features to the react component
npm i --save watch-props
import React from 'react'
import watchProps from 'watch-props'
@watchProps
class App extends React.Component{
watch={
id: function(newValue, oldValue){
console.log(newValue, oldValue) //print "100, 1"
}
}
}
class Home extends React.Component{
state = {
id: 1
}
componentDidMount(){
setTimeout(()=>{
this.setState({
id: 100
})
},1000)
}
render(){
return <App id={this.state.id} />
}
}
原文链接:https://github.com/hellosean1025/watch-props
本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。
转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]