本文整理汇总了TypeScript中leaflet.Util.template方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Util.template方法的具体用法?TypeScript Util.template怎么用?TypeScript Util.template使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类leaflet.Util
的用法示例。
在下文中一共展示了Util.template方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
_loadTileP: function(zoom, x, y) {
const head = document.getElementsByTagName('head')[0],
key = zoom + '_' + x + '_' + y,
functionName = 'lu_' + key,
wk = this._windowKey,
self = this;
const url = L.Util.template(
this._url,
L.Util.extend(
{
cb: wk + '.' + functionName,
s: L.TileLayer.prototype._getSubdomain.call(this, { x: x, y: y }),
x: x,
y: y,
z: zoom
},
this.options
)
);
const script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script.setAttribute('src', url);
window[wk][functionName] = function(data) {
self._cache[key] = data;
delete window[wk][functionName];
head.removeChild(script);
};
head.appendChild(script);
},
示例2: _template
private _template(data: Photo) {
var template =
'<b class="title">{title}</b>' +
'<a href="https://www.flickr.com/photos/{owner}/{id}" target="_blank">' +
'<img class="photo" src="{url_s}" alt="{title}" width="{width_s}" height="{height_s}">' +
'</a>' +
'<a href="http://flickr.com" target="_blank" class="flickr-logo">' +
'Flickr' +
'</a>' +
'<a class="owner" href="https://www.flickr.com/photos/{owner}" target="_blank">{ownername}</a>';
return L.Util.template(template, data);
}
示例3: function
_onMouseOver: function(evt) {
// Update text
this._tooltip.innerHTML = L.Util.template(this._tiptext, evt.data);
// Update position
L.DomUtil.setPosition(
this._tooltip,
this._map.latLngToLayerPoint(evt.latlng)
);
// Show the tooltip
this._tooltip.style.display = 'block';
},
示例4:
L.Util.bind(() => {}, {});
L.Util.stamp({});
L.Util.throttle(() => {}, 123, {});
L.Util.wrapNum(123, []);
L.Util.wrapNum(123, [], true);
L.Util.falseFn();
L.Util.formatNum(123);
L.Util.formatNum(123, 1);
L.Util.trim('word ');
L.Util.splitWords('word word');
L.Util.setOptions({}, {});
L.Util.getParamString({});
L.Util.getParamString({}, '');
L.Util.getParamString({}, '', true);
L.Util.template('template', {});
L.Util.isArray({});
L.Util.indexOf([], {});
L.Util.requestAnimFrame(() => {});
L.Util.requestAnimFrame(timestamp => console.log(timestamp), {});
L.Util.requestAnimFrame(() => {}, {}, true);
L.Util.cancelAnimFrame(1);
L.Util.emptyImageUrl;
interface MyProperties {
testProperty: string;
}
(L.polygon(simplePolygonLatLngs) as L.Polygon<MyProperties>).feature.properties.testProperty = "test";
(L.marker([1, 2], {
示例5:
points.bindPopup(function ({feature}) {
return L.Util.template('<p>Gate {F_Area_ID}<br>{TA}<br><br>More stuff here!</p>', feature.properties);
});