Bladeren bron

setup 组件名称问题

wangkang3 2 jaren geleden
bovenliggende
commit
3e2be5edc5

+ 2 - 1
common/vue/project/vite-js-base/package.json

31
    "unplugin-auto-import": "^0.11.2",
31
    "unplugin-auto-import": "^0.11.2",
32
    "unplugin-vue-components": "^0.22.4",
32
    "unplugin-vue-components": "^0.22.4",
33
    "vite": "^3.0.7",
33
    "vite": "^3.0.7",
34
    "vite-plugin-svg-icons": "^2.0.1"
34
    "vite-plugin-svg-icons": "^2.0.1",
35
    "vite-plugin-vue-setup-extend": "^0.4.0"
35
  }
36
  }
36
}
37
}

+ 1 - 1
common/vue/project/vite-js-base/src/views/index.js

10
  },
10
  },
11
  {
11
  {
12
    path: '/overview',
12
    path: '/overview',
13
    name: 'Overview',
13
    name: 'overview',
14
    meta: {
14
    meta: {
15
      title: '方案概览',
15
      title: '方案概览',
16
      keepAlive: true
16
      keepAlive: true

+ 1 - 1
common/vue/project/vite-js-base/src/views/login/login.vue

6
    <svg-icon class="icon" name="xiugai" :size="22"></svg-icon>
6
    <svg-icon class="icon" name="xiugai" :size="22"></svg-icon>
7
  </div>
7
  </div>
8
</template>
8
</template>
9
<script setup>
9
<script setup name="login">
10
import { getCurrentInstance, ref } from 'vue'
10
import { getCurrentInstance, ref } from 'vue'
11
import { useStore } from 'vuex'
11
import { useStore } from 'vuex'
12
const num = ref(0)
12
const num = ref(0)

+ 8 - 1
common/vue/project/vite-js-base/src/views/main/main.vue

1
<template>
1
<template>
2
  <base-panel title="记得加">
2
  <base-panel title="记得加">
3
    <div>{{ num }}</div>
4
    <el-button @click="add">Default</el-button>
3
    <base-form ref="formRef" v-bind="FormConfig" v-model="formData"></base-form>
5
    <base-form ref="formRef" v-bind="FormConfig" v-model="formData"></base-form>
4
    <el-button @click="check">check</el-button>
6
    <el-button @click="check">check</el-button>
5
    <base-table
7
    <base-table
12
  </base-panel>
14
  </base-panel>
13
</template>
15
</template>
14
16
15
<script setup>
17
<script setup name="overview">
16
import { ref } from 'vue'
18
import { ref } from 'vue'
19
const num = ref(0)
20
21
const add = () => {
22
  num.value = num.value + 1
23
}
17
const formData = ref({})
24
const formData = ref({})
18
const FormConfig = ref({
25
const FormConfig = ref({
19
  labelWidth: '100px',
26
  labelWidth: '100px',

+ 3 - 2
common/vue/project/vite-js-base/vite.config.js

4
import AutoImport from 'unplugin-auto-import/vite'
4
import AutoImport from 'unplugin-auto-import/vite'
5
import Components from 'unplugin-vue-components/vite'
5
import Components from 'unplugin-vue-components/vite'
6
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
6
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
7
7
import VueSetupExtend from 'vite-plugin-vue-setup-extend'
8
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
8
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
9
9
10
// https://vitejs.dev/config/
10
// https://vitejs.dev/config/
26
        svgoOptions: true,
26
        svgoOptions: true,
27
        // 指定symbolId格式
27
        // 指定symbolId格式
28
        symbolId: 'icon-[dir]-[name]'
28
        symbolId: 'icon-[dir]-[name]'
29
      })
29
      }),
30
      VueSetupExtend()
30
    ],
31
    ],
31
    resolve: {
32
    resolve: {
32
      alias: [
33
      alias: [