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