6

帮忙看看 Vue 的问题

 2 years ago
source link: https://www.v2ex.com/t/821969
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  Vue.js

帮忙看看 Vue 的问题

  longkas239 · 15 小时 7 分钟前 · 737 次点击

环境 vite + vue3 + element plus, 组件中的两端 script 代码,这两处 setup 看日志有一处没有运行,是正常的吗,app 引用的时候提示找不到 "form"

App.vue

<script setup>
	import moment from 'moment/min/moment-with-locales'
    import { ref, reactive, toRefs, toRef } from 'vue'
    console.log("setup from setup");
</script>


<script>
    import { reactive, toRefs } from 'vue';
    export default {
        setup() {
            console.log("setup from default");
            const state = reactive({
                form: {
                    userName: '',
                    newPass: '',
                }
            });
            return {
                ...toRefs(state),
            }
        },
</script>


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK