Vux项目搭建

1、快速搭建项目模板

因为项目使用vux,所以推荐使用vux官网的airyland/vux2 模板,vue-cli工具是vue项目的搭建脚手架

默认为 webpack2 模板,如果你需要使用webpack1,请使用 vue init airyland/vux2#webpack1 projectPath

vue init airyland/vux2 myfirst3

? Project name y
? Project description ceshi
? Author ymn
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? No
? Setup unit tests No
? Setup e2e tests with Nightwatch? No

vue-cli · Generated "myfirst3".

To get started:

cd myfirst3
npm install
npm run dev

Documentation can be found at https://vuejs-templates.github.io/webpack

 

 

2、运行模板文件

打开本地8080端口可以看到模板运行如下

注意:如包安装没有报错,npm run dev报错,很可能是8080端口冲突

3、安装 less

1
npm install less less-loader --save-dev

4.main.js  全局注册 toast  /  alert  /  loading

1
2
3
4
5
// 全局引入 loading/toast/alert
import  { LoadingPlugin, ToastPlugin, AlertPlugin } from  'vux'
Vue.use(LoadingPlugin)
Vue.use(ToastPlugin)
Vue.use(AlertPlugin)

5.调用

1
2
3
4
5
6
7
8
9
// 显示等待框
this .$vux.loading.show({
   text:  '加载中...'
});
 
// 隐藏等待框
setTimeout(() => {
   this .$vux.loading.hide()
}, 300);

 

1
2
3
4
5
6
// 提示信息
this .$vux.toast.show({
   type:  'text' ,
   position:  'middle' ,
   text:  '请输入查询内容!'
});

.

转载于:https://www.cnblogs.com/topguntopgun/p/9340117.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值