feat(增加script命令): 限制性init:iconfont再执行dev:weapp

This commit is contained in:
xuan 2022-09-05 10:40:18 +08:00
parent e9e8864c95
commit 81ca19ee0b
5 changed files with 17 additions and 22 deletions

View File

@ -3,6 +3,7 @@ module.exports = {
env: { env: {
NODE_ENV: '"pre"', NODE_ENV: '"pre"',
}, },
outputRoot: 'build',
defineConstants: { defineConstants: {
CURRENT_BASE_URL: '"https://pre.zzfzyc.com/lymarket"', CURRENT_BASE_URL: '"https://pre.zzfzyc.com/lymarket"',
}, },

View File

@ -3,6 +3,7 @@ module.exports = {
env: { env: {
NODE_ENV: '"production"', NODE_ENV: '"production"',
}, },
outputRoot: 'build',
defineConstants: { defineConstants: {
CURRENT_BASE_URL: '"https://www.zzfzyc.com/lymarket"', CURRENT_BASE_URL: '"https://www.zzfzyc.com/lymarket"',
}, },

View File

@ -9,7 +9,8 @@
"css": "sass" "css": "sass"
}, },
"scripts": { "scripts": {
"build:weapp": "npx iconfont-taro && taro build --type weapp", "init:iconfont": "npx iconfont-taro",
"build:weapp": "taro build --type weapp",
"build:swan": "taro build --type swan", "build:swan": "taro build --type swan",
"build:alipay": "taro build --type alipay", "build:alipay": "taro build --type alipay",
"build:tt": "taro build --type tt", "build:tt": "taro build --type tt",
@ -18,17 +19,17 @@
"build:qq": "taro build --type qq", "build:qq": "taro build --type qq",
"build:jd": "taro build --type jd", "build:jd": "taro build --type jd",
"build:quickapp": "taro build --type quickapp", "build:quickapp": "taro build --type quickapp",
"dev:weapp": "npx iconfont-taro && npm run build:weapp -- --watch", "dev:weapp": "npm run init:iconfont && npm run build:weapp -- --watch",
"dev:swan": "npm run build:swan -- --watch", "dev:swan": "npm run build:swan -- --watch",
"dev:alipay": "npm run build:alipay -- --watch", "dev:alipay": "npm run build:alipay -- --watch",
"dev:tt": "npm run build:tt -- --watch", "dev:tt": "npm run build:tt -- --watch",
"dev:h5": "npm run build:h5 -- --watch", "dev:h5": "npm run init:iconfont && npm run build:h5 -- --watch",
"dev:rn": "npm run build:rn -- --watch", "dev:rn": "npm run build:rn -- --watch",
"dev:qq": "npm run build:qq -- --watch", "dev:qq": "npm run build:qq -- --watch",
"dev:jd": "npm run build:jd -- --watch", "dev:jd": "npm run build:jd -- --watch",
"dev:quickapp": "npm run build:quickapp -- --watch", "dev:quickapp": "npm run build:quickapp -- --watch",
"build:weapp:pre": "npx iconfont-taro && cross-env NODE_ENV=pre taro build --type weapp", "build:weapp:pre": "npm run init:iconfont && cross-env NODE_ENV=pre taro build --type weapp",
"dev:weapp:pre": "npx iconfont-taro && cross-env NODE_ENV=pre npm run build:weapp -- --watch" "dev:weapp:pre": "npm run init:iconfont && cross-env NODE_ENV=pre npm run build:weapp -- --watch"
}, },
"browserslist": [ "browserslist": [
"last 3 versions", "last 3 versions",

View File

@ -1,12 +1,13 @@
import { useGlobalIconFont } from './components/iconfont/helper' import { useGlobalIconFont } from './components/iconfont/helper'
export default defineAppConfig({ export default defineAppConfig({
pages: ['pages/user/index', pages: [
'pages/index/index', 'pages/index/index',
'pages/order/index', 'pages/order/index',
'pages/shopping/index', 'pages/shopping/index',
'pages/searchPage/index', 'pages/searchPage/index',
'pages/customerPage/index', 'pages/customerPage/index',
'pages/saleuserPage/index', 'pages/saleuserPage/index',
'pages/user/index'
], ],
window: { window: {
backgroundTextStyle: 'light', backgroundTextStyle: 'light',

View File

@ -31,13 +31,13 @@ const CustomTabBar: FC = () => {
console.log('sdfasdfa', state) console.log('sdfasdfa', state)
return state.tabBarData return state.tabBarData
}) })
const tabBarIndexMap = useMemo(() => { // const tabBarIndexMap = useMemo(() => {
let map: TabBarIndexMap = {} // let map: TabBarIndexMap = {}
for (let i = 0; i < tabItem.length; i++) { // for (let i = 0; i < tabItem.length; i++) {
map[tabItem[i].id] = tabItem[i] // map[tabItem[i].id] = tabItem[i]
} // }
return map // return map
}, [tabItem]) // }, [tabItem])
console.log('selectedId', selectedId) console.log('selectedId', selectedId)
const dispatch = useDispatch<Dispatch<TabBarAction>>() const dispatch = useDispatch<Dispatch<TabBarAction>>()
@ -52,15 +52,6 @@ const CustomTabBar: FC = () => {
dispatch({ type: TabBarType.SET_SELECTED, data: { tabItem, selectedId: id } }) dispatch({ type: TabBarType.SET_SELECTED, data: { tabItem, selectedId: id } })
} }
// const router = useRouter()
// console.log('getCurrentPages==>', router)
// handleSelectTabItem(tabItem.find((item) => item.pagePath === router.path)?.id!)()
// useDidShow(() => {
// console.log('getCurrentPages==>', router)
// })
return ( return (
<View className={styles.customTabBar}> <View className={styles.customTabBar}>
<View className={styles['customTabBar-line']}></View> <View className={styles['customTabBar-line']}></View>