摘要:
1、store/index.js: import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) export default new Vuex.Store({ state: { buttonPermission: { add: true, 阅读全文
posted @ 2021-08-10 22:27
吴小明-
阅读(334)
评论(0)
推荐(0)
摘要:
定义一个Title组件,在使用的时候,通过父组件传值level去定义这个title是h1~h6 1、components/Title.vue: <template> <h1 v-if="level 1"> <a href=""> <slot></slot> </a> </h1> <h2 v-else 阅读全文
posted @ 2021-08-10 21:57
吴小明-
阅读(60)
评论(0)
推荐(0)
摘要:
inheritAttrs和$attrs的作用: 当需要将父组件的props传递到子组件中,而子组件的需要接收到props的节点有父级容器,那么就需要用到这两个属性。 将inheritAttrs设置为false,在子组件需要接收props的节点上加上 v-bind='$attrs' 如果父组件中在子组 阅读全文
posted @ 2021-08-10 18:00
吴小明-
阅读(206)
评论(0)
推荐(0)
摘要:
1、vue-ssr/index.template.html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge 阅读全文
posted @ 2021-08-10 11:42
吴小明-
阅读(649)
评论(0)
推荐(0)
摘要:
客户端渲染:前端去服务端获取数据,自己生成dom 服务端渲染:服务端生成dom返回给前端,有利于seo优化 客户端渲染: 服务端渲染: 利用vue-server-renderer渲染一个vue实例: 1、vue-ssr文件夹执行 npm init -y 安装所需插件:npm i vue vue-se 阅读全文
posted @ 2021-08-10 10:24
吴小明-
阅读(318)
评论(0)
推荐(0)