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: '请输入查询内容!'
});

.

posted on   topguntopgun  阅读(198)  评论(0编辑  收藏  举报

编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示