提交 beb63304 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

refactor: 代码优化

上级 77b2ac8f
......@@ -28,29 +28,14 @@ defineProps({
const attrs = useAttrs()
const hasPropsAttr = computed(():boolean => {
// #ifdef APP-ANDROID
return attrs.has('val')
// #endif
// #ifndef APP-ANDROID
return !!attrs['val']
// #endif
return attrs['val'] != null
})
const hasEmitsAttr = computed(():boolean => {
// #ifdef APP-ANDROID
return attrs.has('childClick')
// #endif
// #ifndef APP-ANDROID
return !!attrs['childClick']
// #endif
return attrs['childClick'] != null
})
const hasClassAttr = computed(():boolean => {
// #ifdef APP-ANDROID
return attrs.has('class')
// #endif
// #ifndef APP-ANDROID
return !!attrs['class']
// #endif
return attrs['class'] != null
})
</script>
......@@ -26,28 +26,13 @@ export default {
},
computed: {
hasPropsAttr(): boolean {
// #ifdef APP-ANDROID
return this.$attrs.has('val')
// #endif
// #ifndef APP-ANDROID
return !!this.$attrs['val']
// #endif
return this.$attrs['val'] != null
},
hasEmitsAttr(): boolean {
// #ifdef APP-ANDROID
return this.$attrs.has('childClick')
// #endif
// #ifndef APP-ANDROID
return !!this.$attrs['childClick']
// #endif
return this.$attrs['childClick'] != null
},
hasClassAttr(): boolean {
// #ifdef APP-ANDROID
return this.$attrs.has('class')
// #endif
// #ifndef APP-ANDROID
return !!this.$attrs['class']
// #endif
return this.$attrs['class'] != null
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册