如何在Laravel 9项目中安装Vuetify

您所在的位置:网站首页 laravel开发模式 如何在Laravel 9项目中安装Vuetify

如何在Laravel 9项目中安装Vuetify

2023-03-27 00:50| 来源: 网络整理| 查看: 265

当您在Webpack项目中安装Vuetify时,您不需要更改Laravel中的任何内容,除了如下所示的常规Vue:

webpack.min.js // located in laravel root directory mix.js('resources/js/app.js', 'public/js') .vue() .sass('resources/sass/app.scss', 'public/css');

在resources/js/plugins/vueity和vuetify目录中创建一个目录,创建一个新文件index.js,在index.js中可以这样做:

import Vue from 'vue' import Vuetify from 'vuetify' import 'vuetify/dist/vuetify.min.css' Vue.use(Vuetify) // opts options are optional, but I've added them as a simple. const opts = { theme: { dark: true }, rtl: true } export default new Vuetify(opts)

现在在app.js中:

import vuetify from './plugins/vuetify' // and import the js file const app = new Vue({ ... vuetify, // add this line ... });

然后在根组件或etc中添加v-app,如下所示:

App.vue // this tag as a root element in your vue app is necessary. I'm an alert with a right border and blue-grey color

当然,如果您有任何冲突,可以使用下面的依赖项:

"devDependencies": { "@popperjs/core": "^2.10.2", "axios": "^0.25", "bootstrap": "^5.1.3", "laravel-mix": "^6.0.6", "lodash": "^4.17.19", "postcss": "^8.1.14", "resolve-url-loader": "^2.3.1", "sass": "^1.32.11", "sass-loader": "^11.0.1", "vue": "^2.6.12", "vue-loader": "^15.9.8", "vue-template-compiler": "^2.6.12" }, "dependencies": { "vuetify": "^2.6.4" }

上面的依赖项并不都与Vuetify相关,但在版本中发生冲突时,您可以像上面这样设置库的版本。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3