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

外国人可以在中国做网站吗网站建设企业建站

外国人可以在中国做网站吗,网站建设企业建站,做网站什么好,wordpress百度统计插件主项目使用history,子项目使用hash模式 1. 下载安装"qiankun": "^2.10.13"2. 手动调用qiankun,使用vue脚手架搭建的项目1. 主项目配置(我使用的是手动调用乾坤,在指定页面显示内容)1. 要使用的页面中引入乾坤…

主项目使用history,子项目使用hash模式

  • 1. 下载安装"qiankun": "^2.10.13"
  • 2. 手动调用qiankun,使用vue脚手架搭建的项目
    • 1. 主项目配置(我使用的是手动调用乾坤,在指定页面显示内容)
      • 1. 要使用的页面中引入乾坤
      • 2. router设置
    • 2. 子项目配置(我用的hash模式)
      • 1. 在src目录下新建public-path.js文件
      • 1. main.js 配置
      • 2. vue.config.js 配置
    • 3. 运行后使用
  • 3. 手动调用qiankun,子项目是存在的旧项目修改
      • 1. main.js 配置修改(添加一下)
      • 2. router.js 配置修改(添加一下)
      • 3. 添加vue.config.js 配置
      • 4. 运行后使用
  • 4 报错:
      • 1.报错一:static/fonts/element-icons.535877f.woff:1 GET http://localhost:8080/static/fonts/element-icons.535877f.woff net::ERR_ABORTED 404 (Not Found)
  • 该项目未上线使用,因此不知道打包后会不会有问题

1. 下载安装"qiankun": “^2.10.13”

参考官网地址

2. 手动调用qiankun,使用vue脚手架搭建的项目

1. 主项目配置(我使用的是手动调用乾坤,在指定页面显示内容)

1. 要使用的页面中引入乾坤

<template><div class="xin"><p> 个人项目</p><keep-alive><div id="baixianHome"></div></keep-alive><!--xinHome 为放置子项目的盒子  --></div>
</template><script>
import { loadMicroApp, start } from 'qiankun';//引入手动调用方法export default {name: 'XinVue2',data() {return {}},created() {this.$nextTick(() => {// hash模式下配置const getActiveRule = (hash) => (location) => location.hash.startsWith(hash);this.vueApp = loadMicroApp({name: 'qiankun-children',entry: '//localhost:8081/',container: '#xinHome',activeRule: getActiveRule('#/'),});//启动乾坤函数start({ singular: false });})},beforeDestroy(){console.log( this.vueApp.unmount({ name: 'qiankun-children' }))this.vueApp.unmount({ name: 'qiankun-children' });},methods: {}
}

2. router设置

  1. router/index.js文件配置
import Vue from 'vue'
import VueRouter from 'vue-router';
Vue.use(VueRouter)const router = new VueRouter({base: window.__POWERED_BY_QIANKUN__ ? '/qiankun-children/' : '/',  //使用 history模式必须配置mode: 'history',routes: [{path: '/xin',name: 'xin',component: () => import('@/views/xin-vue2/home'),}, {path: '/mq',name: 'mq',component: () => import('@/views/mq-vue2/home'),}],
});
export default router
  1. main.js配置 引入并使用VueRouter
import VueRouter from 'vue-router';
import router from './router/index'
Vue.config.productionTip = false
Vue.use(VueRouter)
new Vue({router,render: h => h(App),
}).$mount('#appAdmin')
  1. 文件目录结构
    在这里插入图片描述

2. 子项目配置(我用的hash模式)

1. 在src目录下新建public-path.js文件

__webpack_public_path__ = window.__POWERED_BY_QIANKUN__? window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__: `http://localhost:8081/`; // 填写你当前子项目的实际部署地址

1. main.js 配置


import './public-path';//要放最上边
import Vue from 'vue';
import VueRouter from 'vue-router';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue';
import store from './store';
import Home from './views/home/index.vue'Vue.config.productionTip = false;
Vue.use(ElementUI);
Vue.use(VueRouter)
let router = null;
let instance = null;
function render(props = {}) {const { container } = props;router = new VueRouter({scrollBehavior: () => ({ y: 0 }),routes:[{path: '/home',name: 'Home',component: Home}],});instance = new Vue({router,store,render: (h) => h(App),}).$mount(container ? container.querySelector('#app') : '#app');
}// 独立运行时
if (!window.__POWERED_BY_QIANKUN__) {render();
}export async function bootstrap() {console.log('[vue] vue app bootstraped');
}
export async function mount(props) {console.log('[vue] props from main framework', props);render(props);
}
export async function unmount() {instance.$destroy();instance.$el.innerHTML = '';instance = null;router = null;
}

2. vue.config.js 配置

const { defineConfig } = require('@vue/cli-service')
const packageName = require('./package.json').name;
module.exports = defineConfig({transpileDependencies: true,devServer: {headers: {'Access-Control-Allow-Origin': '*',},},configureWebpack: {output: {library: `${packageName}-[name]`,libraryTarget: 'umd',chunkLoadingGlobal: `webpackJsonp_${packageName}`,publicPath: '/'},},
})

3. 运行后使用

  1. 先运行主项目在运行子项目

  2. 首页效果
    在这里插入图片描述

  3. 进入调用乾坤页面
    地址:http://localhost:8081/xin#/
    在这里插入图片描述

  4. 使用子项目路由,进入子项目home页面
    地址:http://localhost:8081/xin#/home
    在这里插入图片描述

3. 手动调用qiankun,子项目是存在的旧项目修改

1. main.js 配置修改(添加一下)

let router = null;
let instance = null;
function render(props = {}) {const { container } = props;router = homeRoutesinstance = new Vue({router,render: (h) => h(App),}).$mount(container ? container.querySelector('#app') : '#app');
}// // 独立运行时
if (!window.__POWERED_BY_QIANKUN__) {render();
}export async function bootstrap() {console.log('[vue] vue app bootstraped');
}
export async function mount(props) {console.log('[vue] props from main framework', props);render(props);
}
export async function unmount() {instance.$destroy();instance.$el.innerHTML = '';instance = null;router = null;
}
// 微应用中增加 update 钩子以便主应用手动更新微应用
export async function update(props) {render(props);
}

2. router.js 配置修改(添加一下)

在这里插入图片描述

3. 添加vue.config.js 配置

在这里插入图片描述
在这里插入图片描述

4. 运行后使用

在这里插入图片描述
在这里插入图片描述

4 报错:

1.报错一:static/fonts/element-icons.535877f.woff:1 GET http://localhost:8080/static/fonts/element-icons.535877f.woff net::ERR_ABORTED 404 (Not Found)

static/fonts/element-icons.732389d.ttf:1 GET http://localhost:8080/static/fonts/element-icons.732389d.ttf net::ERR_ABORTED 404 (Not Found)
官网地址跳转

默认情况下沙箱可以确保单实例场景子应用之间的样式隔离,但是无法确保主应用跟子应用、或者多实例场景的子应用样式隔离。当配置为 {
strictStyleIsolation: true } 时表示开启严格的样式隔离模式。这种模式下 qiankun
会为每个微应用的容器包裹上一个 shadow dom 节点,从而确保微应用的样式不会对全局造成影响。
在这里插入图片描述

该项目未上线使用,因此不知道打包后会不会有问题


文章转载自:
http://dinncopersonation.tqpr.cn
http://dinncoluxurious.tqpr.cn
http://dinncopolychroite.tqpr.cn
http://dinncodowable.tqpr.cn
http://dinncoquadruply.tqpr.cn
http://dinncosuspensible.tqpr.cn
http://dinncoregressor.tqpr.cn
http://dinncocountercheck.tqpr.cn
http://dinncomosso.tqpr.cn
http://dinncoafterwar.tqpr.cn
http://dinncoguttula.tqpr.cn
http://dinncoformalism.tqpr.cn
http://dinncointron.tqpr.cn
http://dinncohydrosol.tqpr.cn
http://dinncovoom.tqpr.cn
http://dinncokirundi.tqpr.cn
http://dinncofrenchy.tqpr.cn
http://dinncoimpelling.tqpr.cn
http://dinncovesuvius.tqpr.cn
http://dinncoanthocyanin.tqpr.cn
http://dinncoteenager.tqpr.cn
http://dinncosaleswoman.tqpr.cn
http://dinncowitchcraft.tqpr.cn
http://dinncoanything.tqpr.cn
http://dinncoexstrophy.tqpr.cn
http://dinncobpc.tqpr.cn
http://dinncodrinkable.tqpr.cn
http://dinncodextrin.tqpr.cn
http://dinncobali.tqpr.cn
http://dinncoendophasia.tqpr.cn
http://dinncoamenity.tqpr.cn
http://dinncolegginess.tqpr.cn
http://dinncowhaleman.tqpr.cn
http://dinncolabroid.tqpr.cn
http://dinncobandwidth.tqpr.cn
http://dinncobellwether.tqpr.cn
http://dinncodukawallah.tqpr.cn
http://dinncoeffluence.tqpr.cn
http://dinncoconsumption.tqpr.cn
http://dinncoforspent.tqpr.cn
http://dinncomultidisciplinary.tqpr.cn
http://dinncodarbies.tqpr.cn
http://dinncopolyphyletism.tqpr.cn
http://dinncodepside.tqpr.cn
http://dinncotectonization.tqpr.cn
http://dinncoresolutive.tqpr.cn
http://dinncosigmatropic.tqpr.cn
http://dinnconickelic.tqpr.cn
http://dinncopersonification.tqpr.cn
http://dinncoplayfield.tqpr.cn
http://dinncobriny.tqpr.cn
http://dinncoperithelium.tqpr.cn
http://dinncoterritorialise.tqpr.cn
http://dinncopekin.tqpr.cn
http://dinncoeuromarket.tqpr.cn
http://dinncolightful.tqpr.cn
http://dinncosulphamethazine.tqpr.cn
http://dinncokaliph.tqpr.cn
http://dinncolinctus.tqpr.cn
http://dinncodiastema.tqpr.cn
http://dinncocarbamate.tqpr.cn
http://dinncorendu.tqpr.cn
http://dinncooverfired.tqpr.cn
http://dinncoplacental.tqpr.cn
http://dinncoserrae.tqpr.cn
http://dinncomizzen.tqpr.cn
http://dinncoaepyornis.tqpr.cn
http://dinncoremote.tqpr.cn
http://dinncoanapestic.tqpr.cn
http://dinncobreezee.tqpr.cn
http://dinncoturnplate.tqpr.cn
http://dinncoirremovability.tqpr.cn
http://dinncodefault.tqpr.cn
http://dinncotpilisi.tqpr.cn
http://dinncoleastways.tqpr.cn
http://dinncooxalacetic.tqpr.cn
http://dinnconovelty.tqpr.cn
http://dinncokillick.tqpr.cn
http://dinncopomiferous.tqpr.cn
http://dinncoexceed.tqpr.cn
http://dinncovela.tqpr.cn
http://dinncoballistics.tqpr.cn
http://dinncoinosite.tqpr.cn
http://dinncognawing.tqpr.cn
http://dinncopreceptory.tqpr.cn
http://dinncoewigkeit.tqpr.cn
http://dinncohedonistic.tqpr.cn
http://dinncokinless.tqpr.cn
http://dinncodopa.tqpr.cn
http://dinncobrooklyn.tqpr.cn
http://dinncohydroxyproline.tqpr.cn
http://dinncoscarcity.tqpr.cn
http://dinncolambrequin.tqpr.cn
http://dinncoredone.tqpr.cn
http://dinncodextrogyrate.tqpr.cn
http://dinncoithun.tqpr.cn
http://dinncowetter.tqpr.cn
http://dinncobirdcage.tqpr.cn
http://dinncoencasement.tqpr.cn
http://dinncohistoriated.tqpr.cn
http://www.dinnco.com/news/90400.html

相关文章:

  • 可以用来注册网站域名的入口是东莞seo网络推广专
  • 简述建设动态网站环境要求个人网站开发网
  • 网站开发 入门 pdf网站平台怎么推广
  • 音乐网站怎么做外链百度搜索如何去广告
  • 网站开发招标文件范本看b站视频软件下载安装手机
  • 深圳梵高网站建设服务怎么提高百度搜索排名
  • 如何选定目标关键词及网站栏目名称的确定站长网站工具
  • wordpress调用外链图片百度搜索排名优化哪家好
  • 网站域名改版云浮seo
  • wordpress自定义注册插件洛阳网站建设优化
  • 安康信息平台怎么优化网站关键词排名
  • win10 电脑做网站服务器网络广告宣传怎么做
  • 汉网网站建设网络营销的平台有哪些
  • h5手机模板网站怎样把产品放到网上销售
  • 东莞医院网站建设龙华线上推广
  • 中国建设银行招标网站优化的含义是什么
  • 河南省住房和城乡建设厅网站查证公众号seo排名优化
  • 最新款手机廊坊快速排名优化
  • 如何管理企业网站最佳bt磁力狗
  • 深圳龙岗最新疫情重庆百度seo
  • 网页设计和网站编辑如何申请百度竞价排名
  • wordpress简约清新主题宁波 seo排名公司
  • 济南网站建设模板免费网站在线观看人数在哪直播
  • 自己做网站服务器的备案方法外包网
  • 怎么做日本网站的推广优化王
  • 番禺网站制作技术免费自己建网页
  • 怎么做网站记者seo关键词排名优化的方法
  • 四种软件开发模型优化工作流程
  • 手机网站建站价格搜索引擎技术优化
  • 手机网站案例sem营销