Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

插件开发:使用 Provider 提示 setStore 方法未定义 #4688

Closed
K-walker opened this issue Oct 25, 2019 · 3 comments
Closed

插件开发:使用 Provider 提示 setStore 方法未定义 #4688

K-walker opened this issue Oct 25, 2019 · 3 comments
Assignees

Comments

@K-walker
Copy link

问题描述

在插件页面中使用 Provider 提示 setStore 方法未定义

复现步骤

  1. 通过taro init创建插件开发模板项目
  2. 在插件页面使用 Provider
  3. 执行 taro build --plugin weapp 报错
  4. 提示 setStore 未定义

image

import Tabbar from '@/plugin/components/Tabbar';
import { store } from '@/plugin/store';
import { Navigator, View } from '@tarojs/components';
import { Provider } from '@tarojs/redux';
import Taro from '@tarojs/taro';

import style from './index.module.scss';

const DEFAULT_TABS = [
  {id:1,text:'首页',icon:'iconx5'},
  {id:2,text:'商城',icon:'iconx3'},
  {id:3,text:'我的',icon:'iconx1'},
];
export default function Home () {

  const handleTabItemClick = (index) => {
    console.log(DEFAULT_TABS[index]);
  }
  return (
    <Provider store={store}>
      <View className={style.home}>
        <View className={style.container}>
          <Navigator url="plugin-private://wxb4617adf983d7b05/pages/me/index">个人中心</Navigator>
        </View>
        <Tabbar tabs={DEFAULT_TABS} onClick={handleTabItemClick} />
      </View>
    </Provider>
  )
}

期望行为

Provider 使用不报错

报错信息

image

系统信息

  • 操作系统::macOS 10.14.4
  • Taro 版本: 1.3.21
  • Node.js 版本: 10.15.3
  • 报错平台: 微信插件
@taro-bot
Copy link

taro-bot bot commented Oct 25, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@Chen-jj
Copy link
Contributor

Chen-jj commented Nov 15, 2019

@K-walker 复现不了,看看依赖是否装好了吧。

编译后代码:

image

@taro-bot
Copy link

taro-bot bot commented Nov 15, 2019

Hello~

您的问题我们无法复现。如果有空的话还请拔冗提供一个简单的复现 demo,否则这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

@Chen-jj Chen-jj closed this as completed Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants