06 2022 档案
摘要:1.map实现 Array.prototype.myMap = function map(fn, context) { if (typeof fn !== "function") { throw new Error("you should give a function"); } let arr =
阅读全文
摘要:1、安装 yo 和 generator-code yarn global add yo generator-code 2、执行 yo code 生成插件脚手架 yo code 配置项说明:选择插件类型* ? What type of extension do you want to create?
阅读全文
摘要:1不带参数路由渲染(hash路由) 1.1定义三个组件 const Foo = {template:'<div>foo</div>'} const Bar = {template:'<div>bar</div>'} const NotFound = { template: '<div>NotFoun
阅读全文
摘要:使用ui组件如elementUI的表单也会有自带的校验,vue也能自己定义校验规则插件 如 <script src="./vue.js"></script> <div id="app"> <form @submit="validate"> <input v-model="text"> <br> <i
阅读全文
摘要:实现方式:类似于在数据字典中查找对应的翻译 <script src="./vue.js"></script> <div id="app"> <h1>{{$t('welcome-message')}}</h1> <button @click="changeLang('en')">English</bu
阅读全文
摘要:1,我们需求<Example :tags="['h1','h2','h3']"></Example>能够生成 <div> <h1>0</h1> <h2>1</h2> <h3>2</h3> </div> 此时我们可以自定义render函数渲染 <script src="./vue.js"></scri
阅读全文