【uni-app】在新窗口中打开链接
生活随笔
收集整理的這篇文章主要介紹了
【uni-app】在新窗口中打开链接
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
前言
- 在 uni-app 應(yīng)用中,<a href="xxx" target="_blank">打開新頁(yè)面</>不能實(shí)現(xiàn)預(yù)期的效果(在新窗口中打開頁(yè)面)。
- uni-app 應(yīng)用運(yùn)行到chrome瀏覽器中
在新窗口中打開外部鏈接
<template><view class="content"><navigator url="#" @click="openBaidu">在新窗口中打開百度</navigator></view> </template><script>export default {data() {return {}},methods: {openBaidu: function() {var href = "http://www.baidu.com";window.open(href, '_blank');},}} </script>在新窗口中打開內(nèi)部鏈接
<template><view class="content"><navigator url="#" @click="openCompany">在新窗口中打開company</navigator></view> </template><script>export default {data() {return {}},methods: {openCompany: function() {var { href } = this.$router.resolve({ path: "pages/company/company", query: { id: 1 } }); window.open(href, '_blank');},}} </script>總結(jié)
以上是生活随笔為你收集整理的【uni-app】在新窗口中打开链接的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Mybatis】resultMap继承
- 下一篇: Mac如何压缩文件Mac如何压缩文件为r