flask跳转页面参数加上#?
我有页面,页面链接是 http:localhost/test, 我定义的路由是
@app.route('/test')
def test:
.....
怎样用代码跳转到
http:localhost/test#test
呢?使用
url_for()
跳转到
.../test
时,我是用的
redirect(url_for('app.test'))
,那跳转到
.../test#test
我又该怎么写呢?
trace
9 years, 1 month ago
Answers
@app.route('/')
def index():
return redirect(url_for('test', _anchor='test'))
@app.route('/test')
def test():
return 'done'
无谓的信仰
answered 9 years, 1 month ago