Skip to content

Commit

Permalink
Merge branch 'feat/3.5-theta' of github.com:NervJS/taro into feat/3.5…
Browse files Browse the repository at this point in the history
…-theta
  • Loading branch information
Chen-jj committed Jul 7, 2022
2 parents 5eae8f8 + 5fa352a commit 4c721b5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion packages/taro-helper/src/swcRegister.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ export class InjectDefineConfigHeader extends Visitor {
}
}

export default function createSwcRegister ({ only, plugin }) {
interface ICreateSwcRegisterParam {
only
plugin?
}

export default function createSwcRegister ({ only, plugin }: ICreateSwcRegisterParam) {
const config: Record<string, any> = {
only: Array.from(new Set([...only])),
jsc: {
Expand Down
4 changes: 2 additions & 2 deletions packages/taro-router/src/router/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { bindPageResize } from '../events/resize'
import { bindPageScroll } from '../events/scroll'
import { setHistoryMode } from '../history'
import { initTabbar } from '../tabbar'
import { addLeadingSlash, routesAlias, stripBasename } from '../utils'
import { addLeadingSlash, routesAlias, stripBasename, stripTrailing } from '../utils'
import stacks from './stack'

function setDisplay (el?: HTMLElement | null, type = '') {
Expand Down Expand Up @@ -85,7 +85,7 @@ export default class PageHandler {
}
)?.[0] || routePath

return !!pagePath && this.tabBarList.some(t => t.pagePath === pagePath)
return !!pagePath && this.tabBarList.some(t => stripTrailing(t.pagePath) === pagePath)
}

isSamePage (page?: PageInstance | null) {
Expand Down
2 changes: 2 additions & 0 deletions packages/taro-router/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const hasBasename = (path = '', prefix = '') =>
export const stripBasename = (path = '', prefix = '') =>
hasBasename(path, prefix) ? path.substr(prefix.length) : path

export const stripTrailing = (str = '') => str.replace(/[?#][\s\S]*$/, '')

class RoutesAlias {
conf: Array<string[]> = []

Expand Down

0 comments on commit 4c721b5

Please sign in to comment.