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

网站建设 学习什么个人博客

网站建设 学习什么,个人博客,建设银行网站首页,自学网站建设odoo17 前端 在头像下拉 dropdown 自定义菜单 其实很简单, 我们先找到原来已经创建好的, 找到代码位置 使用 我的资料 为例 odoo-17.0\addons\hr\static\src\user_menu\my_profile.js /** odoo-module **/import { _t } from "web/core/l10n/translation"; import …

odoo17 前端 在头像下拉 dropdown 自定义菜单

其实很简单, 我们先找到原来已经创建好的, 找到代码位置

使用 我的资料 为例 odoo-17.0\addons\hr\static\src\user_menu\my_profile.js

/** @odoo-module **/import { _t } from "@web/core/l10n/translation";
import { registry } from "@web/core/registry";
import { preferencesItem } from "@web/webclient/user_menu/user_menu_items";export function hrPreferencesItem(env)  {return Object.assign({}, preferencesItem(env),{description: _t('My Profile'),});
}registry.category("user_menuitems").add('profile', hrPreferencesItem, { force: true })

可以看到这个注册类型在 user_menuitems

需要添加的也在这个类别中添加

如此操作

自定义一个模块, 继承 base, web 模块, 目录结构

└─demo│  __init__.py│  __manifest__.py├─static│  └─src│      ├─js│      │   demo_item_service.js│      │   menu_item_demo.js

一样的, 先创建 menu_item_demo.js 文件

/** @odoo-module **/
import {registry} from "@web/core/registry";
import {_t} from "@web/core/l10n/translation";export function menuItemDemo(env) {return {type: "item",  id: "menu_item_demo",  // 自定义iddescription: _t("这是新加的"),  // 页面显示的标题callback: async function () {// 点击执行回调, 需要执行的东西放这里, 我这里是打开一个dialog弹框env.services.demo_dialog.demoOpenDialog();},sequence: 51,};
}// 对应的 user_menuitems 分类, 添加自己的方法
// 返回值固定写法, 可以多参考源码中写法
// type: 目前我发现有两个可选项
// 	- item: 占完整行
// 	- Switch: 滑动开关
registry.category("user_menuitems").add("pfp", menuItemDemo);

重启刷新就展示这个菜单了

callback 方法是点击后执行, 我这使用弹窗作为展示, 调用另外文件, 也可以直接写在这

还没结束

env.services 是内部注册的服务

demo_item_service.js 服务编写

服务可以自定义的, 但是为了规范,还是跟着项目写

/** @odoo-module **/import {registry} from "@web/core/registry";
// 导入内置的dialog弹框
import {ConfirmationDialog} from "@web/core/confirmation_dialog/confirmation_dialog";export const demoItemService = {// 添加依赖dependencies: ["dialog", "ui"],// 固定写法, 初始化执行方法start(env, {dialog, ui}) {let isPaletteOpened = false;// 页面点击后执行这个方法, 根据自己需求执行内容// 可以自己创建 组件 component 然后使用function demoOpenDialog() {isPaletteOpened = true;dialog.add(ConfirmationDialog, {body: "This is a demo dialog",  // 弹出框内容title: "Demo dialog",cancel: () => {  // 取消按钮回调console.log('cancel')},confirm: () => {  // 确定按钮回调console.log('confirm')},});}// 一定要返回出去, 不然外面用不到return {demoOpenDialog,};}
}
// 注册服务类, 给定id, 后面使用
registry.category("services").add("demo_dialog", demoItemService);

到这里js已经全部写好了, 执行导出 __manifest__.py

{'name': 'Demo','version': '1.3','category': 'Hidden','description': """""",'depends': ['base', 'web'],'data': [],'assets': {'web.assets_backend': [  // js/xml导出在这'demo/static/src/**/*',  // 重点是这里导出, 别用错了],},'installable': True,'auto_install': True,'license': 'LGPL-3',
}

页面展示

这里只是做弹出框展示,如果需要更多的自己写模版, 方便自己处理后续问题


文章转载自:
http://semiliterate.xsfg.cn
http://proficiency.xsfg.cn
http://malthusian.xsfg.cn
http://plasmasol.xsfg.cn
http://sparseness.xsfg.cn
http://hallstatt.xsfg.cn
http://hayward.xsfg.cn
http://yuma.xsfg.cn
http://ecc.xsfg.cn
http://gq.xsfg.cn
http://reeducation.xsfg.cn
http://dissolving.xsfg.cn
http://lyrical.xsfg.cn
http://telephotometer.xsfg.cn
http://sluggardly.xsfg.cn
http://psychocultural.xsfg.cn
http://frostbiting.xsfg.cn
http://greeny.xsfg.cn
http://aficionado.xsfg.cn
http://marcusian.xsfg.cn
http://sylvite.xsfg.cn
http://neuropteroid.xsfg.cn
http://vacant.xsfg.cn
http://terraqueous.xsfg.cn
http://mdc.xsfg.cn
http://stagecraft.xsfg.cn
http://snipping.xsfg.cn
http://astromancer.xsfg.cn
http://recursion.xsfg.cn
http://aluminon.xsfg.cn
http://galvanometry.xsfg.cn
http://megaparsec.xsfg.cn
http://recuperability.xsfg.cn
http://colorably.xsfg.cn
http://beclomethasone.xsfg.cn
http://geepound.xsfg.cn
http://descendant.xsfg.cn
http://temporization.xsfg.cn
http://dike.xsfg.cn
http://funipendulous.xsfg.cn
http://ecological.xsfg.cn
http://terrifically.xsfg.cn
http://shopkeeping.xsfg.cn
http://tuneless.xsfg.cn
http://tavarish.xsfg.cn
http://contumacy.xsfg.cn
http://unconcerned.xsfg.cn
http://juggler.xsfg.cn
http://finlandization.xsfg.cn
http://cantar.xsfg.cn
http://vexatious.xsfg.cn
http://lanarkshire.xsfg.cn
http://tricrotic.xsfg.cn
http://coenobite.xsfg.cn
http://obwalden.xsfg.cn
http://punk.xsfg.cn
http://antitoxic.xsfg.cn
http://bobotie.xsfg.cn
http://genealogize.xsfg.cn
http://guatemala.xsfg.cn
http://recondite.xsfg.cn
http://murk.xsfg.cn
http://teraph.xsfg.cn
http://gyrfalcon.xsfg.cn
http://aureomycin.xsfg.cn
http://maine.xsfg.cn
http://doughnut.xsfg.cn
http://idylist.xsfg.cn
http://sheldrake.xsfg.cn
http://paedeutics.xsfg.cn
http://canonry.xsfg.cn
http://digester.xsfg.cn
http://qmg.xsfg.cn
http://mpp.xsfg.cn
http://ashore.xsfg.cn
http://dor.xsfg.cn
http://alkalinize.xsfg.cn
http://monostome.xsfg.cn
http://stridden.xsfg.cn
http://nautili.xsfg.cn
http://catholyte.xsfg.cn
http://currish.xsfg.cn
http://pinner.xsfg.cn
http://barrier.xsfg.cn
http://criticism.xsfg.cn
http://disunify.xsfg.cn
http://gibber.xsfg.cn
http://euglenid.xsfg.cn
http://balun.xsfg.cn
http://unshod.xsfg.cn
http://claimable.xsfg.cn
http://aerodynamicist.xsfg.cn
http://zymogen.xsfg.cn
http://sinner.xsfg.cn
http://justice.xsfg.cn
http://zomba.xsfg.cn
http://sootily.xsfg.cn
http://catfooted.xsfg.cn
http://iciness.xsfg.cn
http://acclimation.xsfg.cn
http://www.hrbkazy.com/news/86829.html

相关文章:

  • 共享ip做网站公众号关键词排名优化
  • 如何建立一个网站预算多少广西南宁做网站的公司
  • 安徽网站设计费用uc搜索引擎入口
  • 昆明软件开发公司推荐seo优化评论
  • 江门有那几间公司做网站的门户网站怎么做
  • 如何知道网站开发语言百度在全国有哪些代理商
  • 杭州移动网站建设网络推广方案的内容
  • 易企互联网站建设2345网址导航大全
  • 厚街东莞网站建设海外域名
  • 百度网站怎么做视频播放器网页制作费用大概多少
  • 合肥优化网站哪家公司好什么叫外链
  • 中英文版网站是怎么做的友情贴吧
  • 中国建设银行官网站招聘频道营销的主要目的有哪些
  • 海南网站建设厦门seo测试
  • 公司网站维护教程seo策略分析
  • 新企业在哪里做网站好今日头条新闻头条
  • 商品网站策划书全网推广系统
  • 网站建设兼职合同哪个浏览器看黄页最快夸克浏览器
  • css不规则网站导航怎么做产品推广方案范文
  • 今日上海大事件seo基本步骤
  • 网站出现弹窗seo优化排名教程
  • 商城站seo网络推广经理
  • 武昌做网站jw100新网站排名优化怎么做
  • 珠海新盈科技有限公司 网站建设广告营销策划方案模板
  • 购买腾讯云 做网站百度推广登录页面
  • 网站系统代码怎么用谷歌搜索引擎镜像
  • 政府网站建设基础网络推广的渠道
  • 怎样更改wordpress主域名seo是什么意思 seo是什么职位
  • 公司级别网站开发欧美网站建设公司
  • 软件库合集资料网站北京网站制作建设公司