zyuan8591 / aaron-vue-web

https://aaron-vue-web.vercel.app
2 stars 0 forks source link

8. props & emit #8

Open zyuan8591 opened 1 year ago

zyuan8591 commented 1 year ago
const props = defineProps({
  name: {
    type: String,
  },
});
const emit = defineEmits(["update:modelValue"]);

const userName = computed({
  get() {
    return props.name;
  },
  set(newValue) {
    emit("update:modelValue", newValue);
  },
});