fix Button to bug

This commit is contained in:
梁灏 2020-07-03 11:23:53 +08:00
parent b06100ee8d
commit df671ae8c3
2 changed files with 2 additions and 1 deletions

View file

@ -311,6 +311,7 @@
<Divider></Divider> <Divider></Divider>
<Button to="http://baidu.com" replace>http跳转</Button> <Button to="http://baidu.com" replace>http跳转</Button>
<Button to="https://iviewui.com" replace>https跳转</Button> <Button to="https://iviewui.com" replace>https跳转</Button>
<Button :to="{path: '/icon'}">Router 对象跳转</Button>
</div> </div>
</template> </template>
<script> <script>

View file

@ -55,7 +55,7 @@ export default {
window.open(to); window.open(to);
} else { } else {
if (router) { if (router) {
if (this.to.includes('//')) { if ((typeof this.to === 'string') && this.to.includes('//')) {
window.location.href = this.to; window.location.href = this.to;
} else { } else {
this.replace ? this.$router.replace(this.to, () => {}) : this.$router.push(this.to, () => {}); this.replace ? this.$router.replace(this.to, () => {}) : this.$router.push(this.to, () => {});