Open Megic opened 8 years ago
html
<!DOCTYPE html> <html> <head> <title>avalon2+mmRouter</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <script src="./dist/example1.js"></script> </head> <body ms-controller="test"> <h1>avalon2+mmRouter</h1> <p>使用webpack对 avalon与mmRouter进行打包(hash模式)</p> <p><a href='#!/aaa'>点我</a></p> <p><a href='#!/bbb'>点我</a></p> <p>{{@currPath}}</p> <iframe ms-attr="{src:@currPath}" frameborder="0"></iframe> </body> </html>
js
var avalon = require('avalon2') require('../dist/mmRouter') var vm = avalon.define({ $id: 'test', currPath: '' }) avalon.router.add("/aaa", function (a) { // vm.currPath = this.path vm.currPath='example1.html'; }) avalon.router.add("/bbb", function (a) { // vm.currPath = this.path vm.currPath='example2.html'; }) avalon.history.start({ root: "/mmRouter" }) avalon.scan(document.body)
需要点击两次,地址栏才会变动。
如果iframe不用 ms-attr="{src:@currPath}" 设置,则正常
准确来说,应该是页面iframe的src变动导致这个BUG
应该是window与iframe.window共享了历史,导致回退出问题了。这个无法解决!
html
js
需要点击两次,地址栏才会变动。