您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

链接到Flask模板中的特定位置

链接到Flask模板中的特定位置

多亏了dirn的评论,我设法将其与下面的代码一起使用。

传递_anchor关键字以url_for将锚添加生成的URL。

导航菜单

<a href="{{ url_for('.stuff', _anchor='exactlocation') }}">Go to specific id on suff page</a>

烧瓶路线:

@main.route('/')
def stuff():
    return render_template('stuff.html')

stuff.html

...
<section id="exactlocation">
...
Python 2022/1/1 18:53:20 有498人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶