Comparing version 0.7.7 to 0.7.8
@@ -56,3 +56,4 @@ import React from "react"; | ||
leftIcon: '', | ||
leftClick: function () {}, | ||
leftClick: function () { | ||
}, | ||
} | ||
@@ -73,9 +74,8 @@ } | ||
rightText = rightText || this.getRightOpts(rightType).rightText || subTitle; | ||
rightClick = rightClick || this.getRightOpts(rightType).rightClick || subTitleClick || ()=> {}; | ||
rightClick = rightClick || this.getRightOpts(rightType).rightClick || subTitleClick || () => {}; | ||
rightIcon = rightIcon || this.getRightOpts(rightType).rightIcon; | ||
leftType = leftType || 'back'; | ||
leftText = leftText || this.getLeftOpts(leftType).leftText; | ||
leftIcon = leftIcon || this.getLeftOpts(leftType).leftIcon; | ||
leftClick = leftClick || this.getLeftOpts(leftType).leftClick || ()=>{}; | ||
leftClick = leftClick || this.getLeftOpts(leftType).leftClick || () => {}; | ||
@@ -120,3 +120,3 @@ if (leftText && leftText.length > 4) { | ||
backFn: React.PropTypes.func, | ||
theme: React.PropTypes.oneOf(['dark', 'white', 'danger', 'orange']), | ||
theme: React.PropTypes.oneOf(['dark', 'white', 'danger', 'orange', 'red']), | ||
}; | ||
@@ -123,0 +123,0 @@ |
import React from "react"; | ||
import FixedContent from "fengui/component/page/FixedContent"; | ||
import styles from "./AlertPopup.scss"; | ||
import actions from 'fengui/redux/actions'; | ||
import {dispatch} from 'fengui/redux/store'; | ||
@@ -14,4 +16,7 @@ const Component = React.createClass({ | ||
}, | ||
closeAlert(){ | ||
dispatch(actions.setVars("fuiAlert", "")); | ||
}, | ||
render() { | ||
let {message, okText, okClick, cancelText, cancelClick, title} = this.props.options; | ||
let {message, okText, okClick, cancelText, cancelClick, title, isModal = true} = this.props.options; | ||
return ( | ||
@@ -32,4 +37,6 @@ <FixedContent mode="fullWidth" origin="top" className={styles.this}> | ||
</div> | ||
<div className={styles.toast} onClick={cancelClick}> | ||
</div> | ||
{isModal && <div className={styles.toast} onClick={cancelClick}> | ||
</div>} | ||
{!isModal && <div className={styles.toast} onClick={this.closeAlert}> | ||
</div>} | ||
</FixedContent> | ||
@@ -36,0 +43,0 @@ ) |
@@ -12,9 +12,15 @@ let Promise = require('bluebird'); | ||
exports.alert = function (message, okText = '确定', title) { | ||
exports.alert = function (opt, okTextParam = '确定', titleParam) { | ||
let {message, okText, title, isModal = true} = (typeof opt === 'object') ? opt : { | ||
message: opt, | ||
okText: okTextParam, | ||
title: titleParam | ||
}; | ||
return new Promise(function (resolve, reject) { | ||
dispatch(actions.setVars("fuiAlert", { | ||
message: message, | ||
message, | ||
okText, | ||
cancelText: null, | ||
title, | ||
isModal, | ||
okClick: function () { | ||
@@ -28,9 +34,16 @@ dispatch(actions.setVars("fuiAlert", "")); | ||
export function confirm(message, okText = '确定', cancelText = "取消", title) { | ||
export function confirm(opt, okTextParam = '确定', cancelTextParam = "取消", titleParam) { | ||
let {message, okText, cancelText, title, isModal = true} = (typeof opt === 'object') ? opt : { | ||
message: opt, | ||
okText: okTextParam, | ||
cancelText: cancelTextParam, | ||
title: titleParam | ||
}; | ||
return new Promise(function (resolve, reject) { | ||
dispatch(actions.setVars("fuiAlert", { | ||
message: message, | ||
message, | ||
okText, | ||
cancelText, | ||
title, | ||
isModal, | ||
okClick: function () { | ||
@@ -37,0 +50,0 @@ dispatch(actions.setVars("fuiAlert", "")); |
{ | ||
"name": "fengui", | ||
"version": "0.7.7", | ||
"version": "0.7.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/fengjr", |
Sorry, the diff of this file is not supported yet
330562
6011