vue 点击隐藏滚动条
'gallerys': function() {
if (this.gallerys == true) {
document.getElementsByTagName("body")[0].style.overflow = 'hidden'
} else {
document.getElementsByTagName("body")[0].style.overflow = ""
}
},
element ui datePicker 设置当前日期之前的日期不可选
pickerOptions0: { disabledDate(
time) { return time.getTime() < Date.now() - 8.64e7 }},
超出字数变成 ...
var
oldText = magazineBook02Panel01.text;
if
(oldText.length > 7) {
var
newText = oldText.substring(0,5)+
"..."
;
magazineBook02Panel01.setText(newText);
}
截取指定长度变成省略号
item.introduction.substr(0,36)+'...'
hasOwnProperty方法判断属性是否存在 存在返回true不存在返回false
vue charts 配置地图 城市 position: "china-cities",
手机端配置
<!--让IE按照最新版本进行渲染-->
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<!--移动设备优先 视窗 宽度==设备宽度 缩放比例1倍 最大缩放比例一倍 禁止用户缩放 -->
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/>
textarea 禁止拉伸属性 resize:none;
水平垂直居中
<
div class
=
"wrapper"
>
我不知道我的宽度和高是多少,我要实现水平垂直居中
<
/div
>
.
wrapper{ padding:
20
px; background: orange; color:
#fff
; position: absolute; top:
50
%
; left:
50
%
; -webkit-transform:translate(
-
50
%
,
-
50
%
); -moz-transform:translate(
-
50
%
,
-
50
%
); -transform:translate(
-
50
%
,
-
50
%
); }
删除数组里的元素.splice(索引值,删除的个数)
让图片自适应高度宽度 { max-width:100%; max-height:100% }
让数字跟英文超出换行 word-wrap:break-word;
VUE 域名传值
path: '/workdetail/:workid', index.js
this.$router.push('/workdetail/' + id)
workid: this.$route.params.workid,
跳转域名
this.$router.push('/workdetail')
{
path: '/See_exposure/:name/:id',
name: 'See_exposure',
component: See_exposure
} index.js
VUE安装
1、vue init webpack project_name
Use ESLint to lint your code?
选n其余都选Y
2、npm install
3、npm run dev
4、npm run build
全局安装vue
npm install -g vue-cli 全局安装vue脚手架
vue -V
全局安装webpack
npm install -g webpack
安装vue element UI
npm i element-ui -S
安装axios
先安装!
npm install axios
然后!
npm install --save axios vue-axios
安装less
1.npm install less less-loader --save-dev
2、在style中声明lang="less"。 注意: scoped的作用仅仅是限定css的作用域,防止变量污染。
3、这样就可以根据less的语法使用了。
中国标准时间转YYYY/MM格式
this.Report_times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
/*placeholder 设置样式*/
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
color: #A2A2A2;
}
input:-moz-placeholder,
textarea:-moz-placeholder {
color: #A2A2A2;
}
input::-moz-placeholder,
textarea::-moz-placeholder {
color: #A2A2A2;
}
input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
color: #A2A2A2;
}
vue// 回退到上一个路由
this.$router.back(-1)
str.trim() 字符串删除空格
基本正则判断
var reg=/^[-+]?\d*$/;
if(!reg.test(this.sfzhs.trim())){
alert("对不起,您输入的整数类型格式不正确!");//请将“整数类型”要换成你要验证的那个属性名称!
}