使用:NSURLComponents

let htmlPath = Bundle.main.path(forResource: "index", ofType: "html", inDirectory: "www");
//因为存在编码问题,所以存在问题
//let pathWithParameters = "\(htmlPath!)?type=home"
//print("\npathWithParameters:\(pathWithParameters)\n")
//print(URL.init(fileURLWithPath: htmlPath!))
   
let urlComponents = NSURLComponents.init(url: URL.init(fileURLWithPath: htmlPath!),
                                       resolvingAgainstBaseURL: false)
urlComponents?.queryItems = [URLQueryItem.init(name: "type", value: typeValue)]
wkwebView!.uiDelegate = self
wkwebView!.navigationDelegate = self
wkwebView!.load(URLRequest.init(url: urlComponents!.url!))