You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
当定义了props变量,打包时会报错:
error TS2742: The inferred type of 'vue_sfc' cannot be named without a reference to '.pnpm/@VUE+shared@3.4.21/node_modules/@vue/shared'. This is likely not portable. A type annotation is necessary.
`<script setup lang="ts">
import { computed } from 'vue';
defineOptions({ name: 'DemoButton' })
重现链接
https://codesandbox.io/p/github/LomyCool/test-css-bind/main?file=%2Fpackage.json&workspaceId=b692d5d9-9349-485b-b45a-aff272de85c1
Vant 版本
"@vant/cli": "^7.0.1",
描述一下你遇到的问题。
当定义了props变量,打包时会报错:
error TS2742: The inferred type of 'vue_sfc' cannot be named without a reference to '.pnpm/@VUE+shared@3.4.21/node_modules/@vue/shared'. This is likely not portable. A type annotation is necessary.
`<script setup lang="ts">
import { computed } from 'vue';
defineOptions({ name: 'DemoButton' })
//当定义了props变量,打包时会报错,
const props = defineProps({
width: {
type: String,
default: '100px'
},
})
// const width =
100px
const height =
100px
const calcWidth = computed(() => {
return props.width
})
</script>`
重现步骤
1.封装组件,使用TS+setup ;定义一个props
const props = defineProps({
width: {
type: String,
default: '100px'
},
})
2.打包
设备/浏览器
No response
The text was updated successfully, but these errors were encountered: