vue3 composition api uni-app cli项目
报 this.applyAnimatedStyle is not a function
worklet:ongesture="handlepan" 绑定的事件编译成小程序代码后在对应js文件直接找不到
有在uni-app微信小程序里使用worklet手势动画的示例吗?
vue3 composition api uni-app cli项目
报 this.applyAnimatedStyle is not a function
worklet:ongesture="handlepan" 绑定的事件编译成小程序代码后在对应js文件直接找不到
有在uni-app微信小程序里使用worklet手势动画的示例吗?
<script lang="ts">
import WuiNavigationBar from "@/components/wui-navigation-bar.vue";
import {defineComponent} from "vue";
export default defineComponent({
methods: {
scrollUpdateHandler({detail}: any): void {
'worklet'
console.log(detail.scrollTop)
}
},
components: {
WuiNavigationBar
},
})
</script>
<script lang="ts">
import WuiNavigationBar from "@/components/wui-navigation-bar.vue";
import {defineComponent} from "vue";
// @ts-ignore
const {shared: _shared} = wx.worklet
const _offset = _shared(0)
export default defineComponent({
onLoad(query) {
// @ts-ignore
const $this = this.$scope
console.log('offset', _offset.value)
$this.applyAnimatedStyle('.header', () => {
'worklet'
return {
transform: `translateX(${_offset.value}px)`
}
})
},
methods: {
scrollUpdateHandler({detail}: any): void {
'worklet'
_offset.value = detail.scrollTop
},
},
components: {
WuiNavigationBar
},
})
</script>
m***@weiwait.cn
script setup不行,得用options模式
2024-04-23 17:48