站長資訊網
        最全最豐富的資訊網站

        分享laravel8+vue3.0+element-plus搭建方法

        下面由laravel教程欄目給大家介紹分享laravel8+vue3.0+element-plus搭建方法 ,希望對需要的朋友有所幫助!

        分享laravel8+vue3.0+element-plus搭建方法

        前言

        前幾天突然發現出了 vue3.0 ,剛好閑來無事搭個試試。

        開始

        1. 創建 laravel8 項目
          composer create-project laravel/laravel laravel8 --prefer-dist

          laravel new laravel8
        2. 安裝 laravel/ui
          composer require laravel/ui

          根目錄下運行

          php artisan ui vue
        3. 修改 package.json 文件
          "devDependencies": {       "@vue/compiler-sfc": "^3.0.7",       "axios": "^0.21",       "bootstrap": "^4.0.0",       "jquery": "^3.2",       "laravel-mix": "^6.0.6",       "lodash": "^4.17.19",       "popper.js": "^1.12",       "postcss": "^8.1.14",       "resolve-url-loader": "^3.1.2",       "sass": "^1.20.1",       "sass-loader": "^8.0.0",       "vue": "^3.0.7",       "vue-loader": "^16.1.0",       "vue-template-compiler": "^2.6.10"   },   "dependencies": {       "element-plus": "^1.0.2-beta.35",       "vue-router": "^4.0.5"   }
        4. 修改 app.js 文件
          require('./bootstrap');window.Vue = require('vue');window.VueRouter = require('vue-router');import routes from "./router"import axios from "axios"import ElementPlus from 'element-plus'const router = VueRouter.createRouter({   history: VueRouter.createWebHashHistory(),   routes,})import RootComponent from "./components/layouts/App"const app = Vue.createApp(RootComponent)app.config.globalProperties.$http=axios app.use(router)   .use(ElementPlus);app.mount('#app')
        5. 新建 router.js
          import Home from "./components/layouts/Home"export default [   {path:'/',component: Home},]
        6. 新建 App.vue (element-plus 官方文檔例子)
          <template>   <el-container>       <el-header>Header</el-header>       <el-main><router-view></router-view></el-main>       <el-footer>Footer</el-footer>   </el-container></template><script>export default {}</script><style>.el-header, .el-footer {   background-color: #B3C0D1;   color: #333;   text-align: center;   line-height: 60px;}.el-aside {   background-color: #D3DCE6;   color: #333;   text-align: center;   line-height: 200px;}.el-main {   background-color: #E9EEF3;   color: #333;   text-align: center;   line-height: 160px;}body > .el-container {   margin-bottom: 40px;}.el-container:nth-child(5) .el-aside,.el-container:nth-child(6) .el-aside {   line-height: 260px;}.el-container:nth-child(7) .el-aside {   line-height: 320px;}</style>
        7. 新建 Home.vue
          <template>   <p>home</p></template><script>export default {   methods:{       cs(){           axios.post("../index").then(function (response){               console.log(response);           }).catch(function (error){               console.log(error);           })       }   },   mounted() {       this.cs();   }}</script><style scoped></style>
        8. app.scss 引入 element-plus css文件
          // Variables@import 'variables';// Bootstrap@import '~bootstrap/scss/bootstrap';// element-plus@import "~element-plus/lib/theme-chalk/index.css";
        9. 運行命令
          npm install && npm run dev
        10. 效果圖

        分享laravel8+vue3.0+element-plus搭建方法

        控制臺輸出為axios post 請求測試。

        完畢!

        贊(0)
        分享到: 更多 (0)
        網站地圖   滬ICP備18035694號-2    滬公網安備31011702889846號
        主站蜘蛛池模板: 宅男宅女精品国产AV天堂| 2020亚洲男人天堂精品| 99香蕉国产精品偷在线观看| 久久e热在这里只有国产中文精品99 | 亚洲精品成人网久久久久久| 国产精品视频网站| 麻豆成人久久精品二区三区免费 | 亚洲国产精品尤物yw在线 | 日韩精品无码免费视频| 777欧美午夜精品影院| 精品卡一卡二卡乱码高清| 亚洲国产精品成人久久蜜臀 | 久久国产精品99精品国产987| 国产精品视频第一区二区三区| 亚洲一区精品伊人久久伊人| 国产一区二区三区欧美精品| 四虎精品成人免费永久| 97久久综合精品久久久综合| 四虎国产精品永久免费网址| 亚州日韩精品专区久久久| 久久精品中文字幕有码| 精品乱子伦一区二区三区| 国产成人精品免费视频大全| 久久精品国产亚洲网站| 91精品在线播放| 精品爆乳一区二区三区无码av| 少妇精品久久久一区二区三区| 亚洲综合精品网站在线观看| 亚洲精品高清一二区久久| 亚洲国产精品一区二区第四页| 网友偷拍日韩精品| 无码精品人妻一区二区三区AV| 欧美日韩精品一区二区三区不卡 | 国产精品免费观看视频| 国产精品单位女同事在线| 成人国内精品久久久久影院VR| 91精品国产麻豆国产自产在线 | 87国产私拍福利精品视频| 国产精品99久久精品| 97久久精品人妻人人搡人人玩| 精品国内片67194|