当前位置: 首页 > news >正文

wordpress网站模板怎么用mukioplayerwp wordpress

wordpress网站模板怎么用,mukioplayerwp wordpress,久治县wap网站建设公司,有网络打不开网页怎么回事vue-router作为vue全家桶之一的重要插件#xff0c;有必要去深究一下#xff0c;今天我们就从0到1手写一个简化版本。 开始之前#xff0c;我们使用路由插件时是先进行下载路由 npm i vue-router #xff0c;然后在main.js中使用app.use导入router插件。想要手写vue-rou…vue-router作为vue全家桶之一的重要插件有必要去深究一下今天我们就从0到1手写一个简化版本。 开始之前我们使用路由插件时是先进行下载路由 npm i vue-router 然后在main.js中使用app.use导入router插件。想要手写vue-router必须先搞懂app.use()干了一件什么事情。我们去官方文档下面看看。 app.use()​ 安装一个插件。 类型 ts interface App {use(plugin: Plugin, ...options: any[]): this } 详细信息 第一个参数应是插件本身可选的第二个参数是要传递给插件的选项。 插件可以是一个带 install() 方法的对象亦或直接是一个将被用作 install() 方法的函数。插件选项 (app.use() 的第二个参数) 将会传递给插件的 install() 方法。 若 app.use() 对同一个插件多次调用该插件只会被安装一次。 两个组件router-view 和router-link templatea :href# props.toslot/slot/a /templatescript setup const props defineProps({to: {type: String,required: true,}, }); /scriptstyle langcss scoped /style!--* LastEditTime: 2024-08-14 10:45:56* Description: file content -- templatecomponent :iscomponent/component /templatescript setup import { useRouter } from ./index.js; import { computed } from vue; const router useRouter(); const mapRouter new Map(); const reflectMapRouter (router) {router.routes.forEach((route) {// 更具路径进行组件查询保证O(1)时间mapRouter.set(route.path, route.component);}); }; //方法执行进行组件注册 reflectMapRouter(router); //设置为计算属性响应式更新 const component computed(() {const nowRoute mapRouter.get(router.current.value);//这里注意需要进行校验因为用户可能输入错误网址return nowRoute ? nowRoute : null; }); /script style langcss scoped /style/** LastEditTime: 2024-08-14 10:47:43* Description: file content*/ import { ref } from vue; // 对所有页面暴露 const ROUTER_KEY __router__;export const useRouter () {//获取暴露的Router对象return inject(ROUTER_KEY); } class Router {constructor(options) {//history对象就是createHashWebHistroy返回的history对象this.history options.history;// 路由对象数组path,component,name等配置this.routes options.routes;//获取当前路由地址this.current ref(this.history.url);// 这里的方法是监听hashchange事件来更新current切换路由//可以先不看这一段等会会讲this.history.bindEvent(() {this.current.value window.location.hash.slice(1);})}//插件的install方法install(app) {// 全局声明 有一个router 全局使用的对象app.provide(ROUTER_KEY, this);//注册全局组件app.component(router-link, RouterLink);app.component(router-view, RouterView);} } export const createRouter (options) {return new Router(options); } export const createWebHashHistory () {function bindEvent(fn) {window.addEventListener(hashchange, fn);}// history 对象return {url: window.location.hash.slice(1) || /,bindEvent} }
http://www.hkea.cn/news/14370763/

相关文章:

  • 福州seo网站推广大约多少钱
  • 做海购的网站做网站怎么制作
  • 网站备案注销原因做网站时需要FTP工具吗
  • 虚拟机怎么做网站wordpress文章选择标签
  • 兼职做效果图的网站有哪些廊坊做网站的电话
  • 加强文明网站建设企业运营策划公司
  • 来年做啥网站能致富wordpress ad
  • 广州网站推广排名好网站欣赏
  • 手机应用下载网站源码怎么登录智慧团建
  • 虾皮购物网站怎么做wordpress文字环绕广告
  • 定制网站开发介绍图微信小程序开发入门教程
  • 用图片设置网站首页如何使用阿里云建设网站
  • 江西省建设厅网站官网wordpress 文章 模板
  • 网站开发查找漏洞的工具wordpress发布文章提示更新失败
  • 百度站点管理出名的包装设计
  • 传媒公司网站建设思路下载百度2024最新版
  • 济宁网站建设流程购物网站 怎么做
  • 上海网站建设seodian自定义wordpress后台
  • 电子商务网站建设与电子支付用二级页面做网站的源代码
  • 深圳哪些设计公司做网站比较出名网站建设接口开发
  • 企业网站建设找哪家俄罗斯军事新闻最新消息
  • 积极做好门户网站建设工作惠阳做网站公司
  • 织梦cms做多语言的网站什么是seo什么是sem
  • 统计网站建设企业管理咨询公司起名
  • 阿里巴巴吧做网站福州如何做百度的网站
  • 官方模板关键字生成的代码添加在网站的什么地方?东莞常平嘉华学校
  • 网站空间托管合同 .doc东莞市南华职业技术学校
  • 有什么网站是做办公家具做网站销售需要注意的
  • 无法连接到wordpress站点六安市民网
  • 都匀住房和城乡建设厅网站视频号直播怎么引流