﻿---
title: 绑定功能组件
sidemenu: true
---

## 绑定功能组件

这个组件用来绑定功能

> 注意： 需要在 <span style="color: red;">url</span> 上带上 <span style="color: red;">appId</span> 参数 

```tsx
/**
 * background: '#f0f2f5'
 */
import React, { useEffect } from 'react';
import { useDispatch } from 'umi';
import { Space } from 'antd';
import { BindFeature } from '@/components';

export default () => {
  const dispatch = useDispatch();
  useEffect(() => {
    dispatch({
      type: 'public/fetchFeatureTreeDatas',
      payload: 118,
    });
  }, [dispatch]);
  return (
    <Space>
      <BindFeature type="role" id={4295931470}>
        <a>不带时间的feature绑定组件</a>
      </BindFeature>
      <BindFeature isHaveDate type="user" id={4295931470}>
        <a>带时间的feature绑定组件</a>
      </BindFeature>
    </Space>
  );
};
```

<API src="./index.tsx"></API>
