The webview page style of step-by-step higher learning machine S2webapp is out of order.

problem description

when you do webapp development, there is no problem with the online page, but in the step-by-step learning machine S2, app opens the page inside, and div sets the width and height. If there is no text and line-height in it, div will not be opened. In addition, you can use display:-webkit-box;. However, if you want to make a picture width larger than the screen, no matter how wide the img is set, it can only be displayed as the screen width, and there is no problem with other tablets, so there is a page compatibility problem

.

the environmental background of the problems and what methods you have tried

  1. I wrote a test div click to show that the width and height of the screen and the width and height of the user-agent; are 1536mm 2048; but document.documentElement.clientWidth is 1241; the calculated rem is incorrect; the user-agent obtained is Android5.0.2;AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30;
  2. div"s original background is not displayed. Later, if it can be changed to img, it can be changed to img,. If it cannot be changed to img, add text to div and change it to color: transparent; line-height: to div height.
  3. vue introduces a single page written without scaffolding

related codes

/ / Please paste the code text below (do not replace the code with pictures)

/** css **/
.course_small_container {
    width: 13rem;
    height: auto;
    overflow-y: hidden;
    overflow-x: auto;
    padding-top: 0.2rem;
    font-size: 0;
    display: block;
}
.course_small_container img {
    height: 1.654rem;
    width: auto;
    margin-top: 0.2rem;
}

what result do you expect? What is the error message actually seen?

  1. someone who is familiar with the webview kernel can tell the kernel which CSS? can be used. Or the version of css;
  2. the kernel found seems to correspond to Android 4.2. I wonder if it is correct?
  3. how to achieve compatibility with the img above, and the scrolling function can be achieved on this pad;
Dec.01,2021

1, the Android kernel is 4.2, so you can use the webkit-box layout, that is, the old flex layout. JS tries to use native js or jQuery as much as possible.
2, the single-page form of vue scaffolding can be used, but it needs to be compiled to ES5 or lower. It is best to use jQuery to operate dom,vue, then the update may refresh slowly and lead to abnormal display
3. Img has not found the situation you mentioned at present. You can provide a github source code to see
4, document.documentElement.clientWidth and window.innerWidth are related to app's webview setting setInitialScale scaling
5. Target-densitydpi=device-dpi is useful in the webkit kernel below Android4.4, and if not set, the size will not be the same as expected. You can also do the full size of the zoom standard.
6. You can refer to this article. The following instructions on Android4.4 are very useful https://www.cnblogs.com/2050/.

.
Menu