vant按需引入
如果有这样的报错 需要组件提供name名
vue.runtime.esm.js?2b0e:619 [Vue warn]: Unknown custom element:
<van-button> - did you register the component correctly?
For recursive components, make sure to provide the "name" option.
found in
---> <App> at src/App.vue
<Root>
在components中注册组件并添加name名:
import { Button } from 'vant';
export default {
name:'app',
components: {
[Button.name]:Button,
},
}
vant进阶使用引入 rem
通过 npm install postcss postcss-pxtorem --save-dev (用来将px尺寸转化为rem尺寸)
配置rem的根元素字体大小 安装lib-flexiable 安装命令 npm i amfe-flexible --save
注意
这里会报错 postCss 需要8的版本
所以这里建议对postcss-pxtorem进行降级 在mian.js中要引入 postcss-pxtorem
降级命令 npm install postcss-pxtorem@5.1.1 --save
vant 组件库 图片懒加载 import { Lazyload } from ‘vant’;
Vue.use(Lazyload) 在vant标签中使用 lazy-load
// 使用element 组件库表格是 slot-scope="" 需要获取数据 3中使用 #default=’'获取 .row
配置Element-UI:在插件中安装,搜索 vue-cli-plugin-element
new Vue({
delimiters:['${', '}'], //修改默认模板
})