组合式函数 中如何获取到 props #10740
Unanswered
itwmike
asked this question in
Help/Questions
组合式函数 中如何获取到 props
#10740
Replies: 2 comments
-
使用defineProps 提示 defineProps() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect. |
Beta Was this translation helpful? Give feedback.
0 replies
-
export default {
props: ['foo'],
setup(props) {
// setup() 接收 props 作为第一个参数
console.log(props.foo)
}
} 或者你可以干脆直接使用单文件组件+ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
组合式函数 中如何获取到 props
Beta Was this translation helpful? Give feedback.
All reactions