Subscribe on changes!

can request script to expose property when template using in setup-script?

avatar
Sep 23rd 2021

What problem does this feature solve?

first of all, will notify graceful tips for user as if done. and can work better with unimport plugin like no-import~

What does the proposed API look like?

for example:

<template>
    <h1>{{ foo }}</h1>  <!-- expect get tips for user like: please export  foo in script-->
</template>
<script lang="ts" setup>
    // nothing
    // if use unimport plugin, will auto return foo in ctx~
</script>
avatar
Sep 23rd 2021

May be can support api defineReturn like defineExpose?

avatar
Sep 23rd 2021

defineReturn would completely defeat the purpose of script setup which allows you to use everything defined inside: you should explicitly import anything used import { foo } from './file'