摘要: 1 export default { 2 name: "HelloWorld", 3 data() { 4 return { 5 logo:require("./assets/logo.png"), 6 }; 7 } 8 }; 9 </script> 因为动态添加src被当做静态资源处理了,没有进行 阅读全文
posted @ 2020-11-10 14:35 小谷要努力! 阅读(760) 评论(0) 推荐(0)
摘要: 父组件 1 <template> 2 <div id="app"> 3 <HelloWorld :msg="msg" @titleChanged="updateTitle"/> 4 <h2>{{title}}</h2> 5 </div> 6 </template> 7 8 <script> 9 im 阅读全文
posted @ 2020-11-10 14:27 小谷要努力! 阅读(98) 评论(0) 推荐(0)
摘要: 用class关键字创建一个类 创建类方法: 1.构造函数 1 function Point(x,y){ 2 this.x = x; 3 this.y = y; 4 } 5 var point = new Point(2,3); 2.Class 1 class Point { 2 constructo 阅读全文
posted @ 2020-10-15 16:12 小谷要努力! 阅读(378) 评论(0) 推荐(0)
摘要: 能够读取其他函数内部变量的函数(定义在一个函数内的函数) 1 var name = "The Window"; 2 3 var object = { 4 name : "My Object", 5 6 getNameFunc : function(){ 7 return this.name; 8 / 阅读全文
posted @ 2020-10-15 14:41 小谷要努力! 阅读(99) 评论(0) 推荐(0)
摘要: 每个函数都有 prototype 属性,该属性指向原型。 每个对象都有 __proto__ 属性,指向了创建该对象的构造函数的原型。 对象可以通过 __proto__ 来寻找不属于该对象的属性。 构造函数的原型也是一个对象。 阅读全文
posted @ 2020-10-13 14:46 小谷要努力! 阅读(161) 评论(0) 推荐(0)
摘要: map()方法定义在JavaScript的Array中,它返回一个新的数组,新返回数组中的每个元素为原始数组的每一个元素分别调用map中的回调函数处理后的值。 var arr = [1,1,1,1].map(parseInt); document.write(arr); 相当于 arr = [ pa 阅读全文
posted @ 2020-10-10 17:05 小谷要努力! 阅读(93) 评论(0) 推荐(0)
摘要: 先去官网上下载个nodejs 在E盘中新建serve文件夹 执行命令 npm init(一直回车) npm install express -save npm install forever -g server目录下新建一个api.js,一个html的文件夹 api.js中的代码如下: let ex 阅读全文
posted @ 2020-09-15 11:31 小谷要努力! 阅读(537) 评论(0) 推荐(0)