Sun May 21 16:19:00 UTC 2023 inscode

上级 e6cf4087
<script setup>
import {ref} from 'vue';
import baVal = ref(0);
import erzi from './erzi.vue';
const babaMsg = ref("我来自父组件");
const fuValJia = () => {
baVal++;
}
</script>
<template>
<erzi :chuanBaba="babaMsg"></erzi>
<button @click="fuValJia">父组件的值加一</button>
<erzi :title="baVal"></erzi>
</template>
<style scoped>
......
<script setup>
import {ref, toRefs, defineProps } from "vue";
const getVal = defineProps({
chuanBaba: String,
const props = defineProps({
title: {
type:String,
default: "默认值"
}
});
const sss = toRefs(getVal);
console.log(props.title);
</script>
<template>
<div>
获取来自父组件的值:{{ sss }}
获取来自父组件的值:{{ title }}
</div>
</template>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册