首页 > 其他分享 >取公共的APIURL​

取公共的APIURL​

时间:2023-06-09 23:11:42浏览次数:36  
标签:return log APIURL export common 公共 apiurl

取公共的APIURL​

项目新增common目录,里面有个common.js

 

const common = {
    get apiurl(){
		var apiurl = uni.getStorageSync("apiurl");
		if(apiurl==undefined || apiurl == ''){
			apiurl = "http://product.niunan.net";
			uni.setStorageSync("apiurl",apiurl);
		}
        return apiurl;
    } 
}

export default common

  

使用:

 

<script>
	import common from "@/common/common.js"
	export default {
		data() {
			return {
				keyword: '',
			};
		},
		onLoad() {  
			var apiurl = common.apiurl;
			console.log("apiurl:"+apiurl);
		
		},
		methods: {
			setset(){
				console.log("setsetset");
			}
		}
	};
</script>
 

  

 

标签:return,log,APIURL,export,common,公共,apiurl
From: https://www.cnblogs.com/niunan/p/17470471.html

相关文章

  • vue+elementUI 搜索栏公共组件封装,封装多搜索条件通用组件,超实用
    1、新建BaseSearch.vue文件<!--*名称:弹窗的搜索条件组件*功能:methods1.点击搜索的方法:@search2.搜索条件props:formItemList--><template><divclass="dialog-search"><el-form:inline="true"ref="......
  • Nginx漏洞修复:SSL/TLS 服务器瞬时 Diffie-Hellman 公共密钥过弱
    SSL/TLS服务器瞬时Diffie-Hellman公共密钥过弱【原理扫描】。需编辑nginx.conf解决。1、生成dhparams.pem。cd/usr/local/nginx/confopenssldhparam-outdhparams.pem2048chmod-R755dhparams.pem2、编辑nging.conf文件,添加ssl_dhparam{pathto......
  • 刷题日记--最长公共子串问题
    题目描述:给定两个字符串str1和str2,输出两个字符串的最长公共子串abcdebebcd==>bcd实现代码:实现代码publicclassMaxSubString{publicstaticvoidmain(String[]args){Stringst1="abcde";Stringst2="ace";System.out.println......
  • LeetCode 236_ 二叉树的最近公共祖先
    classSolution{public:vector<TreeNode*>path1,path2;booldfs(TreeNode*root,TreeNode*p,vector<TreeNode*>&path){if(!root)returnfalse;if(root==p||dfs(root->left,p,path)||dfs(root->right,p,path))......
  • LeetCode235. 二叉搜索树的最近公共祖先
    classSolution{public:TreeNode*lowestCommonAncestor(TreeNode*root,TreeNode*p,TreeNode*q){if(p->val<root->val&&q->val<root->val)returnlowestCommonAncestor(root->left,p,q);if(p->v......
  • 代码随想录算法训练营第二十二天|235. 二叉搜索树的最近公共祖先,701. 二叉搜索树中的
    [参考链接]235.二叉搜索树的最近公共祖先[注意]1.因为是有序树,所以如果中间节点是q和p的公共祖先,那么中间节点的数组一定是在[p,q]区间的。即中节点>p&&中节点<q或者中节点>q&&中节点<p。2.那么只要从上到下去遍历,遇到cur节点是数值在[p,q]区间中则一......
  • 最长公共子类
     编写一个函数来查找字符串数组中的最长公共前缀。如果不存在公共前缀,返回空字符串 ""。示例1:输入:strs=["flower","flow","flight"]输出:"fl"示例2:输入:strs=["dog","racecar","car"]输出:""解释:输入不存在公共前缀。来源......
  • HDU1403(后缀数组--最长公共子串)
    题目:LongestCommonSubstring题意:判断给定的两个串中,最长的公共串。思路:将它们合并为一个串,然后利用后缀数组求解。首先是二倍增算法:时间复杂度为O(n*log(n))#include<stdio.h>#include<string.h>#definemax1000010intwa[max],wb[max],wv[max],ws[max];intrank[max],he......
  • 找出两个单链表的公共结点
    给定两个单链表,找出两个单链表的公共结点LinkedListSearch_Common_LNode(LinkedList&L1,LinkedList&L2){ LNode*p=L1->next; LNode*q=L2->next; LinkedList&common_L; while(p){ while(q){ if(q->data==p->data){ insert(common_L,q)......
  • 代码随想录算法训练营第21天 | ● 530.二叉搜索树的最小绝对差 ● 501.二叉搜索树中
     第六章 二叉树part07今日内容    详细布置   530.二叉搜索树的最小绝对差  需要领悟一下二叉树遍历上双指针操作,优先掌握递归 题目链接/文章讲解:视频讲解:  501.二叉搜索树中的众数  和 530差不多双指针思路,不过 这里涉及到一个很巧妙的代码......