50-VUE_Rebuild-1

本文记录了将JSP项目重构为Vue.js的过程,包括安装和配置Stylus预处理器,替换EasyUI和layUI为Element-UI,解决跨域问题及登录UI的实现。

声明:关于vue的大部分的知识都差不多掌握了,现在要把jsp全部给改写成vue,每天来写一下重写了哪些东西

1.安装stylus

为了减少代码,在这里还是使用stylus-->css的预处理器

npm install stylus --save

npm install stylus-loader --save

安装2项,stylus & stylus-loader

如果重写jsp,那么其中很多的css样式,第三方的东西,建议就不要花时间去搞了,毕竟你不是专业前端,在css上可能会花费很多的时间,尽量能简单就简单,关于stylus,其实就是一个称之为"css预处理器",给css加了一些函数特性,然后语法的话,也省略了一些大括号阿,冒号之类的,其实这种符号根本没有省略的必要,符号才多少代码,不过还好可读性也还行,缩进式的语法,但是最主要的是,国内关于stylus的讲解比较少,自己对css的什么伪类,不熟...所以还是少碰css为好

2.配置main.js

①Vue.config.productionTip = false

选false,否则你生产调试的时候会出现很多没有必要的提示,警告等

②把app.vue加载到main.js中,有2种,这里不需要用render函数,那就不用=>那个加载app的函数了

3.替换js,css

这里引用了easyUI和layUI的一系列js和css,这里全部给换了,所有的控件,全部给改成element-ui了

4.先写登录的ui

①下载element-ui

②下载完成以后的插件,在package-json里面都是有的

③写好了form然后设置样式

④关于stylus的使用。。随便写了点东西,这个demo太少了。。加上不懂css选择器什么的,能少用就少用

5.img & button

同样,加上element的button和img,然后这里注意一下

img的src是可以写一个请求的,这里不太清楚是否为ajax,但是可以这样写

就等于向后台发送了一个http请求,在这里图片的数据,就是通过这个请求发送了以后返回到response的域对象中

照理来说,肯定不能这样干阿,肯定要异步懒加载的方式加载图片,就像android的ImageLoader一样

6.跨域问题

在console里面发现了有跨域访问的提示,今天还没注意是不是真的解决了跨域访问

我们在config的index.js里面,把 proxyTable里面写上跨域的域名等配置信息,写上跨域的域名,这是前端解决跨域访问的做法,我们明天看看如何在后台解决跨域访问的问题。

7.<title>标签

在vue文件里面是不能写title标签,因为。。。没有。。。我佛了。。。

小结:

今天其实还解决了一些基本的spring的配置代码,然后对vue的写法,好歹实际写了一下,确实有点不习惯脚本语言,总感觉写的有点随意了,明天接着整页面,明天该要弄shiro了,毕竟这个东西现阶段的框架就要用到了

error F:\javaWork\renren-fast-vue\node_modules\node-sass: Command failed. Exit code: 1 Command: node scripts/build.js Arguments: Directory: F:\javaWork\renren-fast-vue\node_modules\node-sass Output: Building: D:\nodejs\node.exe F:\javaWork\renren-fast-vue\node_modules\node-sass\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= gyp info it worked if it ends with ok gyp verb cli [ gyp verb cli 'D:\\nodejs\\node.exe', gyp verb cli 'F:\\javaWork\\renren-fast-vue\\node_modules\\node-sass\\node_modules\\node-gyp\\bin\\node-gyp.js', gyp verb cli 'rebuild', gyp verb cli '--verbose', gyp verb cli '--libsass_ext=', gyp verb cli '--libsass_cflags=', gyp verb cli '--libsass_ldflags=', gyp verb cli '--libsass_library=' gyp verb cli ] gyp info using node-gyp@3.8.0 gyp info using node@18.0.0 | win32 | x64 gyp verb command rebuild [] gyp verb command clean [] gyp verb clean removing "build" directory gyp verb command configure [] gyp verb check python checking for Python executable "python2" in the PATH gyp verb `which` failed Error: not found: python2 gyp verb `which` failed at getNotFoundError (F:\javaWork\renren-fast-vue\node_modules\which\which.js:13:12) gyp verb `which` failed at F (F:\javaWork\renren-fast-vue\node_modules\which\which.js:68:19) gyp verb `which` failed at E (F:\javaWork\renren-fast-vue\node_modules\which\which.js:80:29) gyp verb `which` failed at F:\javaWork\renren-fast-vue\node_modules\which\which.js:89:16 gyp verb `which` failed at F:\javaWork\renren-fast-vue\node_modules\isexe\index.js:42:5 gyp verb `which` failed at F:\javaWork\renren-fast-vue\node_modules\isexe\windows.js:36:5 gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:203:21) gyp verb `which` failed python2 Error: not found: python2 gyp verb `which` failed at getNotFoundError (F:\javaWork\renren-fast-vue\node_modules\which\which.js:13:12) gyp verb `which` failed
最新发布
10-05
npm error code 1 npm error path D:\guli-vue\vue-admin-template-master\node_modules\node-sass npm error command failed npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js npm error Building: E:\NODE\node.exe D:\guli-vue\vue-admin-template-master\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= npm error gyp info it worked if it ends with ok npm error gyp verb cli [ npm error gyp verb cli 'E:\\NODE\\node.exe', npm error gyp verb cli 'D:\\guli-vue\\vue-admin-template-master\\node_modules\\node-gyp\\bin\\node-gyp.js', npm error gyp verb cli 'rebuild', npm error gyp verb cli '--verbose', npm error gyp verb cli '--libsass_ext=', npm error gyp verb cli '--libsass_cflags=', npm error gyp verb cli '--libsass_ldflags=', npm error gyp verb cli '--libsass_library=' npm error gyp verb cli ] npm error gyp info using node-gyp@3.8.0 npm error gyp info using node@22.12.0 | win32 | x64 npm error gyp verb command rebuild [] npm error gyp verb command clean [] npm error gyp verb clean removing "build" directory npm error gyp verb command configure [] npm error gyp verb check python checking for Python executable "python2" in the PATH npm error gyp verb `which` failed Error: not found: python2 npm error gyp verb `which` failed at getNotFoundError (D:\guli-vue\vue-admin-template-master\node_modules\which\which.js:13:12) npm error gyp verb `which` failed at F (D:\guli-vue\vue-admin-template-master\node_modules\which\which.js:68:19) npm error gyp verb `which` failed at E (D:\guli-vue\vue-admin-template-master\node_modules\which\which.js:80:29) npm error gyp verb `which` failed at D:\guli-vue\vue-admin-template-master\node_modules\which\which.js:89:16 npm error gyp verb `which` failed at D:\guli-vue\vue-admin-template-master\node_modules\isexe\index.js:42:5 npm error gyp verb `which` failed at D:\guli-vue\vue-admin-template-master\node_modules\isex如何
03-28
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值