aa
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
{# app_url:Jinja 宏,不依赖 Python 往 context 注入;前缀来自中间件 request.state.web_url_prefix(WEB_URL_PREFIX)或 ASGI root_path #}
|
||||
{% macro app_url(path) -%}
|
||||
{%- set _p = path if path.startswith('/') else '/' ~ path -%}
|
||||
{%- set pre = (request.state.web_url_prefix | default('', true)) | trim -%}
|
||||
{%- if not pre -%}
|
||||
{%- set pre = request.scope.get('root_path', '') | trim -%}
|
||||
{%- endif -%}
|
||||
{{- pre ~ _p if pre else _p -}}
|
||||
{%- endmacro %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
@@ -1038,7 +1047,7 @@
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/echarts@5.5.1/dist/echarts.min.js"></script>
|
||||
<script>
|
||||
window.__URL_PREFIX__ = {{ url_prefix|tojson }};
|
||||
window.__URL_PREFIX__ = {{ (request.state.web_url_prefix | default('', true)) | tojson }};
|
||||
function appPath(p) {
|
||||
p = p.startsWith("/") ? p : ("/" + p);
|
||||
var pre = window.__URL_PREFIX__ || "";
|
||||
|
||||
Reference in New Issue
Block a user