抱歉可能是一个愚蠢的问题 - 我对 QML 很陌生。
我的 StackView 页面之一:
Page
{
id : root
header: ToolBar
{
BackButton
{
anchors.left: parent.left
}
}
}
返回按钮代码:
Button
{
text: "<"
font.pixelSize: 20
width: 30
onClicked: parent.root.StackView.view.pop()
}
我也试过 parent.StackView 。没运气。得到:
TypeError: Cannot call method 'pop' of null
有解决办法吗?