Baozhangchao 3 years ago
parent
commit
33e05de459
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      src/pages/details/NoteDetails/index.jsx

+ 5
- 2
src/pages/details/NoteDetails/index.jsx View File

@@ -108,6 +108,7 @@ export default withLayout((props) => {
108 108
 
109 109
   useEffect(() => {
110 110
     //算出当前宽度下高度的数值
111
+    //防止视频加载完,但是页面没加载完。导致计算错误,所有在这俩都有值的时候才开始计算 
111 112
     if (getVideoWidth || proportion) {
112 113
       const videoHeights = proportion * getVideoWidth;
113 114
       setVideoHeight(videoHeights)
@@ -121,7 +122,7 @@ export default withLayout((props) => {
121 122
     const height = e.detail.height;
122 123
     //视频的宽
123 124
     const width = e.detail.width;
124
-    //算出视频的比例
125
+    //算出视频的高度
125 126
     setProportion(height / width)
126 127
     //res.windowWidth为手机屏幕的宽。
127 128
     // const windowWidth = res.windowWidth;
@@ -199,7 +200,9 @@ export default withLayout((props) => {
199 200
                     className='get-Video-Width'
200 201
                     poster={detail.poster}
201 202
                     onLoadedmetadata={hanleLoade}
202
-                    muted={false} style={{ width: "100%", height: `${videoHeight}px` }} src={detail.videoUrl}
203
+                    muted={false} style={{
204
+                      width: "100%", height: `${videoHeight}px`, transition: 'all 0.3s linear'
205
+                    }} src={detail.videoUrl}
203 206
                   >
204 207
                   </Video>
205 208
               }