Skip to content

Commit

Permalink
Taro Api采用继承export的方式,不再复制Taro-H5的taro.js的代码,解决Vue下,缺少的Api
Browse files Browse the repository at this point in the history
  • Loading branch information
58liuyang committed May 9, 2024
1 parent 82d4a43 commit e953294
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
10 changes: 5 additions & 5 deletions packages/taro-platform-harmony-hybrid/src/api/apis/taro.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Taro from '@tarojs/api'
import DefaultTaroH5 from '@tarojs/taro-h5/dist/api/taro'
import * as taroH5 from '@tarojs/taro-h5/dist/api/taro'

import {
getApp,
Expand Down Expand Up @@ -35,12 +36,11 @@ const NamedTaroHarmonyHybrid: typeof Taro = {
switchTab,
requirePlugin
}

export * from '@tarojs/taro-h5/dist/api/taro'

export default NamedTaroHarmonyHybrid
// 覆写H5的requirePlugin
export {
export const taroHarmonyHybrid = {
...taroH5,
requirePlugin
}

export default NamedTaroHarmonyHybrid

Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import definition from '@tarojs/plugin-platform-harmony-hybrid/dist/definition.json'
import isMatchWith from 'lodash-es/isMatchWith'
import setWith from 'lodash-es/setWith'
import { initLaunchOptions } from 'src/api/apis'
import native from 'src/api/apis/NativeApi'
import { invertColor } from 'src/api/apis/utils/colorConvert'

import Taro from './taro'

Expand Down Expand Up @@ -28,10 +31,6 @@ export function canIUse (scheme = '') {

export default Taro

import native from 'src/api/apis/NativeApi'
import { invertColor } from 'src/api/apis/utils/colorConvert'
import { initLaunchOptions } from 'src/api/apis'

// 同步小程序启动时的参数
Taro.eventCenter.once('__taroRouterLaunch', initLaunchOptions)

Expand Down

0 comments on commit e953294

Please sign in to comment.