Giter VIP home page Giter VIP logo

vuetify-study's Introduction

vuetify-study

运行

npm install

npm run serve

安装 Vuetify

  • 使用 vue-cli 3 初始化一个 Vue 项目

  • 命令行执行 vue add vuetify

  • 命令执行完毕后将初始化一个 Vuetify 的目录结构

    • 若出现问题,尝试新建 src/plugins/vuetify.js 文件并重试

    • 其他意外情况请参照 官方文档

安装 iconfont-mdi

  • 命令行执行 npm install @mdi/font -D

  • 在 /plugins/vuetify.js 中引入

import '@mdi/font/css/materialdesignicons.css'

export default new Vuetify({
  icons: {
    iconfont: 'mdi'
  }
})

Loading 组件需要依赖 Koa2

  • 命令行执行 npm install koa-generator -g 安装生成器

  • 命令行执行 koa2 service 生成一个 koa2 项目

  • 命令行执行 cd service 进入项目目录

  • 命令行执行 npm install 安装依赖

  • 修改 index.js 文件,添加如下代码并保存

  router.get('/getLoadingMsg', async (ctx, next) => {
  // 封装一个延时响应的函数
  async function delay (time) {
    return new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve();
      }, time)
    })
  }
  await delay(3000)
  // 为了允许跨域请求设置的 Headers
  ctx.set('Access-Control-Allow-Origin', '*')
  ctx.set('Access-Control-Allow-Methods', 'GET')
  ctx.body = {
    data: 'hxwnb'
  }
})
  • 命令行执行 npm start 启动服务

  • 访问 http://localhost:3030/getLoadingMsg

    • 若操作正常,应该在 3s 后得到返回数据

    • 保持 koa2 启动,此时 Loading 组件可以观察到效果

vuetify-study's People

Contributors

gstarp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar huyue avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

bill315

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.