ViewPicker
视图选择器,使用该组件可以选择当前维格表的所有视图
参数
Name | Type |
---|---|
props | IViewPicker |
返回值
Element
示例
普通示例
import React, { useState } from 'react';
import { ViewPicker } from '@apitable/widget-sdk';
const Example = () => {
const [viewId, setViewId] = useState()
return <ViewPicker viewId={viewId} onChange={option => setViewId(option.value)} />
}
配合 useCloudStorage 实现持久化存储
import React from 'react';
import { ViewPicker, useCloudStorage } from '@apitable/widget-sdk';
const ExampleCloud = () => {
const [viewId, setViewId] = useCloudStorage('selectViewId');
return <ViewPicker viewId={viewId} onChange={option => setViewId(option.value)} />;
};