Baozhangchao 3 gadus atpakaļ
vecāks
revīzija
33e05de459
1 mainītis faili ar 5 papildinājumiem un 2 dzēšanām
  1. 5
    2
      src/pages/details/NoteDetails/index.jsx

+ 5
- 2
src/pages/details/NoteDetails/index.jsx Parādīt failu

108
 
108
 
109
   useEffect(() => {
109
   useEffect(() => {
110
     //算出当前宽度下高度的数值
110
     //算出当前宽度下高度的数值
111
+    //防止视频加载完,但是页面没加载完。导致计算错误,所有在这俩都有值的时候才开始计算 
111
     if (getVideoWidth || proportion) {
112
     if (getVideoWidth || proportion) {
112
       const videoHeights = proportion * getVideoWidth;
113
       const videoHeights = proportion * getVideoWidth;
113
       setVideoHeight(videoHeights)
114
       setVideoHeight(videoHeights)
121
     const height = e.detail.height;
122
     const height = e.detail.height;
122
     //视频的宽
123
     //视频的宽
123
     const width = e.detail.width;
124
     const width = e.detail.width;
124
-    //算出视频的比例
125
+    //算出视频的高度
125
     setProportion(height / width)
126
     setProportion(height / width)
126
     //res.windowWidth为手机屏幕的宽。
127
     //res.windowWidth为手机屏幕的宽。
127
     // const windowWidth = res.windowWidth;
128
     // const windowWidth = res.windowWidth;
199
                     className='get-Video-Width'
200
                     className='get-Video-Width'
200
                     poster={detail.poster}
201
                     poster={detail.poster}
201
                     onLoadedmetadata={hanleLoade}
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
                   </Video>
207
                   </Video>
205
               }
208
               }