所以我做了以下
-
mkdir test && cd test
-
vue create dev
-
vue add vuetify
- 将(3)和(4)中的所有配置文件移至一个目录(例如,在
test/
下) - 将
vue.config.js
更新为以下内容:
// vue.config.js
module.exports = {
"transpileDependencies": [
"vuetify"
],pages: {
index: {
entry: 'dev/src/main.js',// <--- I changed the root of the project so need to update entry
template: 'dev/public/index.html',filename: 'index.html',}
},devserver: {
overlay: {
warnings: true,errors: true
}
}
}
这有效,当我从npm run serve
运行test/
时感到很高兴。
我想做的是在/dev/src/main.js
中导入并安装多个组件。我可以安装任意数量的特定组件dev/src/App.vue
,但是如果我尝试加载组件/dev/src/components/CountButton.vue
(一个显示其被点击次数的按钮),然后尝试将其安装在{{1} }该组件已安装,但HTML不会更新。
main.js
我将<template>
<div class="">
<v-btn @click="count"> test {{amount}} </v-btn>
</div>
</template>
<script>
import {VBtn} from 'vuetify/lib' // <---- for tree shaking & a la carte
export default {
name: 'CountButton',components: {
VBtn
},data: () =>({
amount: 0
}),methods:{
count() {
this.amount += 1
}
}
}
</script>
更改为的位置
main.js
例如我单击,它始终显示“ test 0”,尽管vue检查器会显示该数量并递增。
我该如何解决?