提交 0ae312ea 编写于 作者: fxy060608's avatar fxy060608

wip(app): add vueFactory

上级 91d7c6f3
......@@ -281,7 +281,7 @@ var serviceContext = (function () {
});
}
const maskClickCallback = [];
var tabBar$1 = {
var tabBarInstance = {
id: '0',
init(options, clickCallback) {
if (options && options.list.length) {
......@@ -374,13 +374,15 @@ var serviceContext = (function () {
};
function initTabBar() {
const len = __uniConfig.tabBar?.list?.length;
const { tabBar } = __uniConfig;
const len = tabBar && tabBar.list && tabBar.list.length;
if (!len) {
return;
}
__uniConfig.tabBar.selectedIndex = 0;
const selected = __uniConfig.tabBar.list.findIndex((page) => page.pagePath === __uniConfig.entryPagePath);
tabBar$1.init(__uniConfig.tabBar, (item, index) => {
const { entryPagePath } = __uniConfig;
tabBar.selectedIndex = 0;
const selected = tabBar.list.findIndex((page) => page.pagePath === entryPagePath);
tabBarInstance.init(tabBar, (item, index) => {
uni.switchTab({
url: '/' + item.pagePath,
openType: 'switchTab',
......@@ -396,8 +398,8 @@ var serviceContext = (function () {
});
if (selected !== -1) {
// 取当前 tab 索引值
__uniConfig.tabBar.selectedIndex = selected;
selected !== 0 && tabBar$1.switchTab(__uniConfig.entryPagePath);
tabBar.selectedIndex = selected;
selected !== 0 && tabBarInstance.switchTab(entryPagePath);
}
}
......
import { invokeHook } from '@dcloudio/uni-core'
import tabBar from './tabBar'
import tabBarInstance from './tabBar'
export function initTabBar() {
const len = __uniConfig.tabBar?.list?.length
const { tabBar } = __uniConfig
const len = tabBar && tabBar.list && tabBar.list.length
if (!len) {
return
}
__uniConfig.tabBar!.selectedIndex = 0
const { entryPagePath } = __uniConfig
tabBar!.selectedIndex = 0
const selected = __uniConfig.tabBar!.list.findIndex(
(page) => page.pagePath === __uniConfig.entryPagePath
const selected = tabBar!.list.findIndex(
(page) => page.pagePath === entryPagePath
)
tabBar.init(
__uniConfig.tabBar!,
tabBarInstance.init(
tabBar!,
(item: UniApp.TabBarItemOptions, index: number) => {
uni.switchTab({
url: '/' + item.pagePath,
......@@ -33,7 +35,7 @@ export function initTabBar() {
if (selected !== -1) {
// 取当前 tab 索引值
__uniConfig.tabBar!.selectedIndex = selected
selected !== 0 && tabBar.switchTab(__uniConfig.entryPagePath!)
tabBar!.selectedIndex = selected
selected !== 0 && tabBarInstance.switchTab(entryPagePath!)
}
}
{
"input": {
"src/index.ts": ["dist/vue.runtime.esm.js"]
}
},
"output": {
"banner": "export default function vueFactory (exports) {\n",
"footer": "}"
},
"external": false
}
export * from '../lib/vue.runtime.esm'
import * as Vue from '../lib/vue.runtime.esm'
exports.Vue = Vue
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册