当我createEpicMiddleware(epic)在 Angular2+ 上调用函数时,出现错误:
“错误 TS2560:类型 '(action$: any) => any' 的值与类型 'Options' 没有共同的属性。你是想调用它吗?”
即使使用https://redux-observable.js.org/在线示例上的示例官方代码,也会出现与上述完全相同的错误。这似乎是createEpicMiddleware函数参数类型错误的错误。我怎么解决这个问题?
对不起,我的英语不流利。我想更改选项卡布局中的起始片段。另一个有意图的活动有一个价值。所以我只想用我的选择开始选项卡布局的片段。
这是主要活动的 onCreate()
public class MainActivity extends AppCompatActivity {
private SectionsPagerAdapter mSectionsPagerAdapter;
private ViewPager mViewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
}
Run Code Online (Sandbox Code Playgroud)
这是在片段中更改的代码
public class SectionsPagerAdapter extends FragmentPagerAdapter …Run Code Online (Sandbox Code Playgroud)