


Detailed explanation of the case analysis of WeChat prohibiting copying link sharing and prohibiting hiding of the menu function in the upper right corner in React Js
This article mainly introduces the solution code for React Js WeChat prohibits copying links, sharing, and hiding the menu in the upper right corner. Friends who need it can refer to it
No more nonsense, I will just post the code for you. The specific code is as follows:
/** * Created by wuyakun on 2017/5/23. */let wxUtils = {}; /** * 是否开启右上角Menu * @param open */ wxUtils.optionMenu = function (open = true) { if (open) { openOptionMenu(); } else { disabledOptionMenu(); } }; /** * 是否禁用右上角 */ function disabledOptionMenu() { if (typeof WeixinJSBridge === "undefined") { if (document.addEventListener) { document.addEventListener('WeixinJSBridgeReady', onBridgeReady(true), false); } else if (document.attachEvent) { document.attachEvent('WeixinJSBridgeReady', onBridgeReady(true)); document.attachEvent('onWeixinJSBridgeReady', onBridgeReady(true)); } } else { onBridgeReady(true); } } /** * 开启menu */ function openOptionMenu() { if (typeof WeixinJSBridge === "undefined") { if (document.addEventListener) { document.addEventListener('WeixinJSBridgeReady', onBridgeReady(false), false); } else if (document.attachEvent) { document.attachEvent('WeixinJSBridgeReady', onBridgeReady(false)); document.attachEvent('onWeixinJSBridgeReady', onBridgeReady(false)); } } else { onBridgeReady(false); } } function onBridgeReady(disable = true) { if (typeof WeixinJSBridge !== "undefined") WeixinJSBridge.call(disable ? 'hideOptionMenu' : 'showOptionMenu'); } /** * 隐藏微信网页底部的导航栏 * @param disable */ wxUtils.disabledToolbar = function (disable = true) { document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() { // 通过下面这个API隐藏底部导航栏 WeixinJSBridge.call(disable ? 'hideToolbar' : 'showToolbar'); }); }; /** * 获取网络类型 */ wxUtils.getNetworkType = function () { //network_type:wifi wifi网络 2 network_type:edge 非wifi,包含3G/2G 3 network_type:fail 网络断开连接 4 network_type:wwan 2g或者3g WeixinJSBridge.invoke('getNetworkType', {}, function (e) { // 在这里拿到e.err_msg,这里面就包含了所有的网络类型 return e; }); }; export default wxUtils;
The usage is very simple:
export default class BaseComponent extends React.Component { componentDidMount() { try { //如果存在location说明是路由Component if (this.props.location) { // 全部禁用分享,想要分享自己开 wxUtils.optionMenu(false); } } catch (e) { // console.log(e); } } }
I wrote it in Base, mainly wxUtils.optionMenu (false);This sentence
The above is the detailed content of Detailed explanation of the case analysis of WeChat prohibiting copying link sharing and prohibiting hiding of the menu function in the upper right corner in React Js. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

1. WeChat is a social platform that pays attention to privacy protection. Users cannot see who has visited their Moments or personal homepage. 2. This design is intended to protect user privacy and avoid potential harassment or snooping. 3. Users can only see the likes and comments records in their circle of friends, further ensuring the confidentiality of personal information.

Thanks to netizens Qing Qiechensi, HH_KK, Satomi Ishihara and Wu Yanzu of South China for submitting clues! According to news on September 2, there are recent rumors that "iPhone 16 may not support WeChat." In response to this, a reporter from Shell Finance called Apple's official hotline. Apple's technical consultant in China responded that whether iOS systems or Apple devices can continue to use WeChat, and WeChat The issue of whether it can continue to be listed and downloaded on the Apple App Store requires communication and discussion between Apple and Tencent to determine the future situation. Software App Store and WeChat Problem Description Software App Store technical consultant pointed out that developers may need to pay fees to put software on the Apple Store. After reaching a certain number of downloads, Apple will need to pay corresponding fees for subsequent downloads. Apple is actively communicating with Tencent,

DeepSeek: A powerful AI image generation tool! DeepSeek itself is not an image generation tool, but its powerful core technology provides underlying support for many AI painting tools. Want to know how to use DeepSeek to generate images indirectly? Please continue reading! Generate images with DeepSeek-based AI tools: The following steps will guide you to use these tools: Launch the AI Painting Tool: Search and open a DeepSeek-based AI Painting Tool (for example, search "Simple AI"). Select the drawing mode: select "AI Drawing" or similar function, and select the image type according to your needs, such as "Anime Avatar", "Landscape"

1. Open the WeChat app, click [Me] at the bottom of the interface, and select the [Settings] function. 2. Click [Chat], click [Chat Background] to enter the chat background setting interface. 3. Click [Select Background Image] or [Select from Album] or [Take a Photo]. 4. Select and click the picture you want to use, and then click [Use] in the upper right corner.

1. To recover deleted WeChat chat history, you need to use two mobile phones for data migration. 2. On the old phone, click [Me] → [Settings] → [Chat] → [Chat History Migration and Backup]. 3. Select [Migrate] and set the target device platform. After selecting the chat history to be restored, click [Start]. 4. Then log in to the same account on the new phone and scan the QR code on the old phone to start the migration. 5. After the migration is completed, the deleted chat history will be restored to the new phone.

1. WeChat Lingqiantong adopts a multi-layer security mechanism, including password protection, real-name authentication, mobile phone binding, etc., to ensure the security of user accounts. 2. WeChat Pay uses a variety of encryption methods, including SSL encrypted transmission, real-time monitoring, etc., to ensure transaction security. 3. WeChat Pay also cooperates with banks and financial institutions to implement risk control and prevention measures to monitor and handle abnormal transactions. 4. When using WeChat Lingqiantong, users should also strengthen the protection of personal accounts, set complex passwords, change passwords regularly, and not disclose personal information at will.

1. On the old device, click "Me" → "Settings" → "Chat" → "Chat History Migration and Backup" → "Migrate". 2. Select the target platform device to be migrated, select the chat records to be migrated, and click "Start". 3. Log in with the same WeChat account on the new device and scan the QR code to start chat record migration.

1. Open the WeChat app, click [Address Book] at the bottom of the interface, and click [New Friend]. 2. Enter the friend’s WeChat ID or nickname in the search box at the top of the page. 3. If the other party has not deleted the user, the user can find the friend in the search results. 4. Click on the friend to enter the chat window with him or her, and you can view the previous chat history.
