项目可以正常使用但是 在视图区就会报红。
如果换一种写法 :style="getRowStyle()"在使用defineProps后在getRowStyle也会报红。
有大神知道什么原因吗?如何解决,谢谢了
<template>
<view class="ch_row" :style="{
padding:`${gutter}px 0 0 ${gutter}px`
}">
<slot></slot>
</view>
</template>
<script lang="uts" setup>
const props =。defineProps({
gutter: {
type: [String, Number],
default: () => 0
}
})
const getRowStyle = () => {
return new Map<string, string>([['padding', `${props.gutter}px 0 0 ${props.gutter}px`]])
}
provide('row_gutter', props.gutter);
</script>
<style>
.ch_row {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
</style>
艾璞 (作者)
我的版本是4.08,没有eslint有关的插件呢。有可能和版本有关系我升级下版本看下
2024-04-15 10:56
艾璞 (作者)
可以了谢谢版本问题
2024-04-15 10:59
爱豆豆
回复 艾璞: 好的
2024-04-15 11:06