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

refactor: 代码优化

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