摘要: 1、局部自定义指令,实现拖拽 <template> <div style="width:100%"> <!-- 自定义指令绑定元素 --> <button v-drag>拖拽</button> </div> </template> <script> export default { name: "L 阅读全文
posted @ 2020-04-24 17:24 Alex-Song 阅读(782) 评论(0) 推荐(0) 编辑
摘要: 1、使用定时器setInterval dateHandle(end){ // 使用定时器,每秒执行获取时间,执行一次函数 let setInt=setInterval(() => { let nowTime=Date.parse(new Date())//现在时间 let endTime=Date. 阅读全文
posted @ 2020-04-24 16:42 Alex-Song 阅读(3294) 评论(0) 推荐(0) 编辑
摘要: 1、通过官方网站获取对应的key值; 2、在html中引入相应script文件 <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=f7f1406a1ee197180c9b7b2444d62b83 阅读全文
posted @ 2020-04-23 16:31 Alex-Song 阅读(7412) 评论(1) 推荐(1) 编辑
摘要: store.js文件内部写法: import vue from 'vue'; // 创建公共数据store export const store = vue.observable({ count: 0 }); // 创建更改状态的方法,创建后在组件内直接使用,也可不使用,在组建内直接书写 expor 阅读全文
posted @ 2020-04-22 17:50 Alex-Song 阅读(495) 评论(0) 推荐(0) 编辑
摘要: <template> <div> <button @click="handle">添加属性</button> <div ref="div">{{change}}</div> </div> </template> <script> export default { name: "Mine", data 阅读全文
posted @ 2020-04-22 16:12 Alex-Song 阅读(378) 评论(0) 推荐(0) 编辑
摘要: console.log(div.offsetWidth) //width+padding+border console.log(div.offsetHeight)//height+padding+border console.log(div.clientWidth)//width+padding-滚 阅读全文
posted @ 2020-04-21 15:41 Alex-Song 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 使用uniapp开发时,可以通过在app.vue中定义全局变量,在没个页面内通过globalData获取 1、app.vue文件内部的写法 <script> export default { globalData: { text: 'text' }, onLaunch: function() { c 阅读全文
posted @ 2020-03-17 17:58 Alex-Song 阅读(3053) 评论(0) 推荐(0) 编辑
摘要: 1、如果需要使用自定义导航栏的时候,需要在page.json文件中做如下更改 "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages { "path": "pages/list/index", "st 阅读全文
posted @ 2020-03-17 10:45 Alex-Song 阅读(8681) 评论(0) 推荐(0) 编辑
摘要: // if语句简单使用 if和else if相比,else if效率更高,因为else if中前面判断过的条件后面不需要再重复判断,而全部使用if则需要重复判断 var one=5; if(one>2){ one+=1; } if(one-=6){ one=3 } //one为0,因为one-=6会 阅读全文
posted @ 2020-03-13 17:56 Alex-Song 阅读(1305) 评论(0) 推荐(0) 编辑
摘要: // ES6的class类 class Point{ constructor(){ } fn1(num){ console.log("被调用了") } } console.log(typeof Point);//function console.log(Point Point.prototype.c 阅读全文
posted @ 2020-01-16 15:17 Alex-Song 阅读(5896) 评论(0) 推荐(0) 编辑