WeChat applet configuration absolute path

There are not many BBs, just upload the code example and follow along

 1. Configure the custom module mapping rule resolveAlias ​​under app.json 

{
    "resolveAlias": {
        "~/*": "/*"
    }
}

2. How to use, take js as an example

import { getUserInfo } from '~/api/user'

It's that simple, don't say that WeChat applets don't support absolute paths anymore.

Guess you like

Origin blog.csdn.net/qq_42044542/article/details/128370027