Skip to content

Commit

Permalink
fix(h5 complier): fix h5 build problem
Browse files Browse the repository at this point in the history
  • Loading branch information
innocces committed Jul 21, 2021
1 parent df904e0 commit 17dcc4e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/app/src/pages/about/index.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.start-button {
position: fixed;
right: 32px;
bottom: 32px;
bottom: 102px;
z-index: 1100;
}
14 changes: 7 additions & 7 deletions packages/app/src/pages/index/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { useCallback, useState } from 'react';
import { AtIcon, AtToast } from 'taro-ui';
import { Image, View } from '@tarojs/components';

import Taro, { ENV_TYPE } from '@tarojs/taro';
import { useEnv } from 'taro-hooks';
import { ENV_TYPE } from '@tarojs/taro';
import { useEnv, useRouter } from 'taro-hooks';

import './index.less';

Expand All @@ -14,18 +14,18 @@ import { List } from '../../constant';
const Index = () => {
const env = useEnv();
const [visible, changeVisible] = useState(false);
const [routerInfo, { navigateTo }] = useRouter();
console.log(routerInfo);

const handleLocation = useCallback(
(route: string) => {
if (env === ENV_TYPE.WEB) {
if (!routerInfo && env === ENV_TYPE.WEB) {
changeVisible(true);
} else {
Taro.navigateTo({
url: '/pages/panel/index?id=' + route.toLowerCase(),
});
navigateTo('/pages/panel/index?id=' + route.toLowerCase());
}
},
[env],
[env, routerInfo, navigateTo],
);

return (
Expand Down
3 changes: 3 additions & 0 deletions packages/app/src/pages/panel/index.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
navigationBarTitleText: 'taro-hooks',
};
13 changes: 11 additions & 2 deletions packages/app/src/pages/useEnv/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@ import DocPage from '@components/DocPage';

import { useEnv } from 'taro-hooks';
import Taro, { ENV_TYPE } from '@tarojs/taro';

import 'taro-ui/dist/style/components/icon.scss';

const ENVTYPE = [
['WEAPP', 'WEAPP'],
['WEB', 'WEB'],
['RN', 'RN'],
['SWAN', 'SWAN'],
['ALIPAY', 'ALIPAY'],
['TT ', 'TT'],
['QQ', 'QQ'],
['JD', 'JD'],
];
const radioOptions = (env: ENV_TYPE) =>
Object.entries(ENV_TYPE).map(([label, value]) => ({
ENVTYPE.map(([label, value]) => ({
label,
value,
desc: `环境: ${label}`,
Expand Down
4 changes: 0 additions & 4 deletions packages/hooks/src/useClipboardData/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ export type Result = [string, clipboardAction];
function useClipboardData(): Result {
const [clipboardData, changeClipborardData] = useState<string>('');

useEffect(() => {
getClipboard();
}, []);

const setClipboard = useCallback<setClipboard>((text: any) => {
if (!text) {
console.warn('please enter a text');
Expand Down

0 comments on commit 17dcc4e

Please sign in to comment.