My vite config looks like this. I want to have two entry points, as you can see in build.lib.entry I have the entry for my library, in this case src/main.js, but I would also like to have one entry for my project because I am testing locally.
// vite.config.js
const path = require('path')
module.exports = {
build: {
lib: {
entry: path.resolve(__dirname, 'src/main.js'),
name: 'MyLib'
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into …Run Code Online (Sandbox Code Playgroud) Vue3 将所有内容打印为“代理”对象。
我知道该值在 [[Target]] 内,但我不想每次都继续扩展 Proxy->[[Target]] 。只是想澄清一下,这根本不会改变输出。这只是一种“更干净”的看待事物的方式。
一个例子:
const b = 'value'
console.log(value)
Output -> { Proxy: { [[Handler]]: ..., [[Target]]: 'value', [[IsRevoked]]: false }
Run Code Online (Sandbox Code Playgroud) 我试图在VUE 3中传递一个emit prop,每次传递它时我仍然得到错误,并且prop无法切换。
手风琴.vue
<template>
<div class="flex" @click="toggleInfo()">
<slot></slot>
</div>
</template
<script>
export default {
props: {
value: {
required: true
}
},
setup(props, { emit }) {
const toggleInfo = () => {
emit('input', !props.value)
}
return {
toggleInfo
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
应用程序.vue
<accordion v-model:value="isOpen">
...// just data
</accordion>
<script>
import { ref } from 'vue'
import accordion from '../components/Accordion.vue'
export default {
components: {
accordion
},
setup() {
const isOpen = ref(false)
return {
isOpen
}
} …Run Code Online (Sandbox Code Playgroud)