摘要: // 获取用户信息的函数 function getUser(path,callback){ return $.get(path,function(info){ return callback(info) }) } 观察getUser()内部的实现,发现callback()被额外包裹了一层没有意义的皮 阅读全文
posted @ 2022-01-16 22:51 YAN-YAN 阅读(32) 评论(0) 推荐(0)
摘要: 在根目录下新建vue.config.js文件 // vue.config.js module.exports = { configureWebpack: { devtool: 'source-map' } } vscode中新建launch.json文件 { "version": "0.2.0", 阅读全文
posted @ 2022-01-11 23:43 YAN-YAN 阅读(432) 评论(0) 推荐(0)
摘要: el-from中表单检验规则重置和数据重置在关闭事件中执行, 取消校验规则是用this.$resf[fromRefs].resetFields() 在reSet()中将fromData对象重新定义一遍 代码示例 export default { data(){ return{ formData:{ 阅读全文
posted @ 2022-01-11 09:06 YAN-YAN 阅读(540) 评论(0) 推荐(0)
摘要: .sync修饰符相当于将值传递到子组件,并且监听这个值得变化 .sync传递单个值 <template> <div id = "app"> <div> <test-sync :show.sync = "show"></test-sync> </div> </div> </template> impo 阅读全文
posted @ 2022-01-10 23:25 YAN-YAN 阅读(379) 评论(0) 推荐(0)
摘要: 非props的Attribute属性就是在子组件中没有使用props属性接收的属性,但在父元素中传递的属性 <template> <div id = "app"> <h1> 非props的Attribute?inheritAttrs </h1> <my-input></my-input> </div 阅读全文
posted @ 2022-01-10 09:12 YAN-YAN 阅读(36) 评论(0) 推荐(0)
摘要: 此方法可以封装自己的组件库 在src目录下新建modules-->index.js + components 文件夹 index.js 文件内容如下 // 导入组件 import YyButtons from './components/yy-button.vue' import YyInput f 阅读全文
posted @ 2022-01-09 18:44 YAN-YAN 阅读(324) 评论(0) 推荐(0)
摘要: vue中使用异步组件的步骤 在components属性中引入组件 在template中使用组件 <template> <div id="app"> <div> <h1> Vue中异步组件的使用 </h1> <button @click="show = !show"> 切换组件 </button> < 阅读全文
posted @ 2022-01-09 12:53 YAN-YAN 阅读(477) 评论(0) 推荐(1)
摘要: 在组件中有定时器任务时,当组件销毁之后定时器任务依然执行,可在destoryed()钩子函数中清除掉 <template> <div> <swiper-destoryed v-if="show"></swiper-destoryed> <button @click="show = false">注销 阅读全文
posted @ 2022-01-09 10:26 YAN-YAN 阅读(260) 评论(0) 推荐(0)
摘要: 单行文本不换行出现省略号 以下三个css属性要配合使用 <div> <p> I love three things in the world: the sun, the moon, and you. The sun for day, the moon for night, and you forev 阅读全文
posted @ 2022-01-08 23:20 YAN-YAN 阅读(103) 评论(0) 推荐(0)
摘要: 函数 函数类型 函数类型包含两部分:类型参数和返回值类型。完整函数类型这两部分都是需要的 let myAdd: (baseValue:number,increament:number) => number = function (x:number,y:number):number{ return x 阅读全文
posted @ 2021-12-26 09:47 YAN-YAN 阅读(63) 评论(0) 推荐(0)