开始
src 备份 src.bak
可以把项目备份,也可以当做工作空间。因为每次新建webpack都需要安装bootstrap、jquery。
找模板 twts_141_PurpleAdmin
去bootstrap找模板
安装vue-meta模块
npm安装1
npm install vue-meta --save
main.js 引入 vue-meta1
2
3
4
5
6import VueMeta from 'vue-meta'
Vue.use(VueMeta, {
// optional pluginOptions
refreshOnceOnNavigation: true
})
安装electron(非必要)1
npm install --save electron
安装popper.js
1 | npm install --save popper.js |
根据index.html分模块
拷贝所有项目到src/assets 目录下
navbar
新建componets NavBar.vue
拷贝index.html的navbar 模块到 NavBar.vue 的template模块。
修改链接:
href=” 修改为 href=”../assets/
src=” 修改为 src=”../assets/
到这里就基本修改好了navbar。
解决整体样式缩小的问题
去掉导入的其他css库1
2// import 'bootstrap/dist/css/bootstrap.min.css'
// import 'bootstrap/dist/js/bootstrap.min'
引入js方法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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60'js1': {
render(createElement) {
return createElement(
'script', {
attrs: {
type: 'text/javascript',
src: './assets/vendors/js/vendor.bundle.base.js',
},
},
);
},
},
'js2': {
render(createElement) {
return createElement(
'script', {
attrs: {
type: 'text/javascript',
src: './assets/vendor.bundle.addons.js',
},
},
);
},
},
'js3': {
render(createElement) {
return createElement(
'script', {
attrs: {
type: 'text/javascript',
src: './assets/js/off-canvas.js',
},
},
);
},
},
'js4': {
render(createElement) {
return createElement(
'script', {
attrs: {
type: 'text/javascript',
src: './assets/js/misc.js',
},
},
);
},
},
'js5': {
render(createElement) {
return createElement(
'script', {
attrs: {
type: 'text/javascript',
src: './assets/js/dashboard.js',
},
},
);
},
},
细节问题解决
去掉eslint检查
1 | .eslintignore内添加 /src/ |
1 | <a class="nav-link" href="/pro"> |
nginx apache tomcat服务器停启
nginx服务停启命令
1 | nginx |
Access-Control-Allow-Origin报错解决:
在nginx.conf中增加1
2
3location / {
add_header 'Access-Control-Allow-Origin' '*';
}
再用以下命令加载1
nginx -s reload
nginx + php 配置
安装php-fpm并启动1
2yum install php-fpm
php_fpm -D
改nginx.conf配置,增加如下配置1
2
3
4location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
}
nginx 反向代理
待续
apache服务停启命令
apache和php结合(配置httpd支持php)
极简安装1
yum install httpd
修改配置文档 /etc/httpd/conf/httpd.conf1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25vim /usr/local/apache2.4/conf/httpd.conf
第一步:取消注释
ServerName www.example.com:80
第二步:将Require all denied 改为Require all granted
<Directory />
AllowOverride none
Require all granted
</Directory>
第三步:增加一行AddType application/x-httpd-php .php
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
第四步:增加索引页index.php
在DirectoryIndex index.html后面 增加索引页index.php
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
检查配置文件httpd.cnf的语法是否正确1
apachectl -t
重新加载配置文件1
service httpd restart
检测php是否正常解析1
2
3
4
5
6
7
8新建一个php文件
vi /var/www/html/1.php
代码:
<?php
phpinfo();
?>
浏览器打开访问 IP:80/1.php
如果显示是图片表格文件则正常;
如果显示为代码为错误;
告错检查步骤:
1、检查是否加载php的模块1
/usr/local/apache2.4/bin/apachectl -M
看看有没有php5_module (shared)
如果没有php5的模块,那么安装1
yum install mod_php
2.检查是否增加php1
2
3
4vi /etc/httpd/conf/httpd.conf
查看是否存在
AddType application/x-httpd-php .php
3.检查是否增加索引页index.php1
DirectoryIndex index.html index.php
图片上传:
需要安装gd库1
yum install php-gd
启动php-fpm:1
php-fpm
LAMP安装
1 | centos参考 |
改apache服务器端口
1 | /etc/httpd/conf/httpd.conf |
改Access-Control-Allow-Origin错误
1
Header set Access-Control-Allow-Origin "*"
改默认登录index.html, index.php
1 | /etc/httpd/conf/httpd.conf |
tomcat服务停启命令
windows系统:1
2shutdown.bat
startup.bat
Linux系统:1
2shutdown.sh
startup.sh
mysql服务停启命令
1 | service mysqld start |
eclipse问题解决
web项目打包
建立java web项目,项目点击右键->export->Runable JAR File->选择主类与本机存储。
vue引入css文件
在入口js文件main.js中引入,一些公共的样式文件,可以在这里引入。
1 | import Vue from 'vue' |
在index.html中引入
1 | <!DOCTYPE html> |
在vue文件中引入
1 | <template> |
vue scoped 引入
1 | <style scoped src="../../static/index.css" /> |
vue 集成 form-making
安装 element-ui
1 | cnpm i element-ui -S |
安装 form-making
1 | cnpm i form-making -S |
main.js 引入
1 | // import ElementUI |
vue 组件引入
引入以下即可使用1
2<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="https://unpkg.com/form-making/dist/FormMaking.umd.js"></script>
或者使用以下方式(推荐)1
2import 'element-ui/lib/index.js'
import 'form-making/dist/FormMaking.umd.js'
webpack.base.conf.js 环境配置
如果报错,则做此步骤1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16{
test: /\.css$/,
include: [
/src/,//表示在src目录下的css需要编译
'/node_modules/element-ui/lib/' //增加此项
],
loader: 'style-loader!css-loader'
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
安装 css-loader 等组件
用npm run dev 运行vue项目时,出现以下错误:1
2
3
4
5
6ERROR Failed to compile with 1 errors 11:17:27
This dependency was not found:
* !!vue-style-loader!css-loader?{"sourceMap":true}!../../node_modules/vue-loader/lib/style-compiler/index?{"vue":true,"id":"data-v-331f341c","scoped":true,"hasInlineConfig":false}!less-loader?{"sourceMap":true}!../../node_modules/vue-loader/lib/selector?type=styles&index=0!./Index.vue in ./src/components/Index.vue
To install it, you can run: npm install --save !!vue-style-loader!css-loader?{"sourceMap":true}!../../node_modules/vue-loader/lib/style-compiler/index?{"vue":true,"id":"data-v-331f341c","scoped":true,"hasInlineConfig":false}!less-loader?{"sourceMap":true}!../../node_modules/vue-loader/lib/selector?type=styles&index=0!./Index.vue
解决方法,看错误中列出了哪几个模块,都给装上:1
npm install stylus-loader css-loader style-loader less-loader --save-dev
form表单验证
1 | // VeeValidate |
wordpress讲解
github下载
1 | https://github.com/sylucky/WordPress |
解压到apache服务器中
1 | 安装apache服务器与mysql服务器 |
配置数据库
1 | CREATE DATABASE wordpress; |
网站登录
网站登录,按提示操作。