Vue 2.0 consult the project to adapt to the mobile side and the computer side, extract the js part, style independent

set up a mobile project under the existing pc project, and then plan to write all the methods in pc to another function folder by module, while pc and the files in the mobile terminal. Vue will only write template and style, and then introduce function/ various module .js files of all modules into index.html. Is this appropriate? How do you do a project that has both a mobile terminal and a mainstream computer terminal?

of course, in the route to determine whether to enter the pc or the mobile page.

Please do not hesitate to comment, thank you.

Apr.11,2021

navigator.userAgent try?


  1. if there is a big functional difference between your mobile and PC products, you can consider using two sets of logic to implement, otherwise, it is recommended that you still have one
  2. .
  3. A set of logic: use responsive style and try to use streaming layout (do not write dead width and height, adaptive)
  4. two sets of logic: the server outputs different pages through userAgent; the public part establishes a father-in-law class library and manages it using npm or git submodule

if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
    window.location.href = "url";
} else {
    window.location.href = "pcurl";
}

it is estimated that the multi-page configuration is a little troublesome, but the code structure will also be clearer.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b39539-4d822.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b39539-4d822.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?