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

draggable-sheet #15429

Open
cat-kun opened this issue Apr 1, 2024 · 1 comment
Open

draggable-sheet #15429

cat-kun opened this issue Apr 1, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@cat-kun
Copy link

cat-kun commented Apr 1, 2024

这个特性解决了什么问题?

https://developers.weixin.qq.com/miniprogram/dev/component/draggable-sheet.html
半屏功能

这个 API 长什么样?

const DraggableSheet = 'draggable-sheet';

<DraggableSheet
    className='sheet'
    initial-child-size='0.5'
    min-child-size='0.2'
    max-child-size='0.8'
    snap
    snap-sizes={[0.4, 0.6]}
  >
    <ScrollView scrollY type='list' associative-container='draggable-sheet' bounces>
      半屏小程序内容
    </ScrollView>
  </DraggableSheet>

通过components 添加新组件、属性,页面无法渲染该组件

// config/index.ts
[
    '@tarojs/plugin-inject',
    {
      components: {
        // 为 ScrollView 组件新增了 'associative-container' 属性
        ScrollView: {
          'associative-container': '',
        },
        // 新增一个组件
        DraggableSheet: {
          'initial-child-size': '',
          'min-child-size': '',
          'max-child-size': '',
          'easing-function': '',
          snap: '',
          'snap-sizes': [],
          'worklet:onsizeupdate': '',
        },
      },
      // 新增的组件需要写映射
      componentsMap: {
        DraggableSheet: 'draggable-sheet',
      },
    },
  ],
@taro-bot2 taro-bot2 bot added the enhancement New feature or request label Apr 1, 2024
This was referenced Apr 6, 2024
@isKiki
Copy link

isKiki commented Sep 18, 2024

Taro3.6.11版本Vue3如何使用DraggableSheet功能 按照以上方法引入出现 Bad attr snap-sizes with message: unexpected token ).错误如何解决?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants