bug fix - refresh
parent
d3befe3723
commit
dde482801e
|
@ -48,17 +48,17 @@ var configMap = {
|
|||
|
||||
function DeviceFrame(props) {
|
||||
var [config, setConfig] = useState({})
|
||||
var [iframeKey, setIframeKey] = useState(100000);
|
||||
var [cacheKey, setCacheKey] = useState(new Date().getTime());
|
||||
|
||||
useEffect(() => {
|
||||
setConfig(configMap[props.device])
|
||||
}, [props.device, config])
|
||||
|
||||
var refresh = () => setIframeKey(Math.round(Math.random() * 10000));
|
||||
var refresh = () => setCacheKey(new Date().getTime());
|
||||
|
||||
useEffect(() => {
|
||||
console.log(props.htmlUrl)
|
||||
refresh()
|
||||
console.log('触发更新', props.htmlUrl);
|
||||
refresh();
|
||||
props.refreshQrCode()
|
||||
}, [props.htmlUrl])
|
||||
|
||||
|
@ -76,7 +76,6 @@ function DeviceFrame(props) {
|
|||
{
|
||||
props.htmlUrl
|
||||
&& <iframe
|
||||
key={iframeKey}
|
||||
id='deviceFrame'
|
||||
style={{
|
||||
position: 'absolute',
|
||||
|
@ -86,7 +85,7 @@ function DeviceFrame(props) {
|
|||
paddingBottom: config.offsetv
|
||||
}}
|
||||
title='preview'
|
||||
src={baseUrl + props.htmlUrl + '?time=' + new Date().getTime()}
|
||||
src={baseUrl + props.htmlUrl + '?cacheKey=' + cacheKey}
|
||||
width={config.width}
|
||||
height={config.height}
|
||||
frameBorder={'0'}/>
|
||||
|
|
Loading…
Reference in New Issue