当前位置:网站首页>How does the applet solve the rendering layer network layer error?

How does the applet solve the rendering layer network layer error?

2022-07-05 03:57:00 Chu Junjun

Use uni-app A small hole in developing small programs : 

In the development process , An error is reported :

[ Render layer network layer error ] Failed to load font http://172.16.0.234:8081/profile/upload/style.ttf net::ERR_CONNECTION_TIMED_OUT  (env: Windows,mp,1.05.2109131; lib: 2.20.2)

When other methods cannot solve it , We can set the global variable mechanism to solve

Use globalData( Global variable mechanism . This mechanism is in uni-app You can also use , And universal at all ends )

uni-app Official website uni-app: A use Vue.js Develop a front-end framework for cross platform applications https://uniapp.dcloud.io/collocation/App?id=globaldata stay APP.vue Join in

<script>
	export default {
		data() {
			return {
				code: null,
				sessionKey: null,
				signature: null,
				rawData: null,
				encryptedData: null,
				iv: null,
			}
		},
		globalData: {
			baseUrl: 'https://xxxxx.xxxxzg.com/web-api/'
			//baseUrl: 'http://172.16.0.xxx:8081'
            
		},
		onLaunch: function() {
			this.globalData
		},
		onLoad() {

		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {

		}
	}
</script>

<style>
	/* Every page is public css */
	body {
		font-family: 'PingFang-SC-Regular';
	}
	@font-face {
		font-family: 'PingFang-SC-Regular'; // Create a number_font Font name 
		/* src: url("http://172.16.0.234:8081/profile/upload/style.ttf"); // Import local font source file  */
		/* src: url("https://exercise.zjyqzg.com/web-api//profile/upload/style.ttf"); // Import local font source file  */
	}

	::-webkit-scrollbar {

		display: none !important;

		width: 0 !important;

		height: 0 !important;

		-webkit-appearance: none;

		background: transparent;

	}
</style>

Then use it in the corresponding page

原网站

版权声明
本文为[Chu Junjun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140718032333.html