感谢@Mike
https://stackoverflow.com/users/10118270/mike
-以下是更新的代码:
import {Map, View} from 'ol';
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';
import {bbox} from 'ol/loadingstrategy';
import {get as getProjection, transformExtent} from 'ol/proj';
...
var source = new VectorSource({
loader: function( extent, resolution, projection ) {
var crs = config.crs || "EPSG:4326";
var url = '/rest/table/' + config.table;
var newExtent = transformExtent( extent, getProjection('EPSG:3857'), getProjection( crs ));
...