曾小晨
曾小晨
  • 发布:2023-03-19 12:43
  • 更新:2023-03-21 10:08
  • 阅读:318

想知道 vue3 nvue 使用 bindingx 的方式

分类:nvue
<view ref="btn" @touchstart="onTouchStart" class="index-add flex-row flex-center">  
  <g-icon type="plus" size="40" color="#fff" />  
</view>  

<script setup>  
const Binding = uni.requireNativePlugin('bindingx');  
const btn = ref()  

function onTouchStart (e) {  
  console.log('???移动么没有效果吗', Binding)  
  Binding.bind({  
    anchor: btn.value,  
    eventType: 'pan',  
    props: [  
      {  
        element: btn.value,  
        property: 'transform.translateX',  
        expression: 'x+0'  
      }  
    ]  
  }, function (e) {  
    // nope  
    console.log(e)  
  })  
}  
</script>  

<style>  
.index-add {  
  width: 90rpx;  
  height: 90rpx;  
  border-radius: 50%;  
  position: fixed;  
  bottom: 50rpx;  
  left: 375rpx;  
  margin-left: -45rpx;  
  box-shadow: 0 6rpx 26rpx -12rpx #00c49d;  
  background-image: linear-gradient(to bottom right, #00c49d, #02ad91);  
}  
</style>

移动不了

2023-03-19 12:43 负责人:无 分享
已邀请:
曾小晨

曾小晨 (作者)

顶一下

曾小晨

曾小晨 (作者)

难道没有人用 vue3 玩 bindingx 吗

曾小晨

曾小晨 (作者)

btn.value 改成 btn.value.ref 就行

要回复问题请先登录注册