场景:项目中有些静态页,没有调用接口,而客户那边就今天改几个字,明天改几个图片这种,客户或者非开发人员吧,还不大会运行项目,这种情况下就很头疼,特别是手里有比较急的项目啥的
个人感觉行的通的方案,就是放在第三方,客户下载个js文件,替换中文或者图片啥的,然后覆盖那个文件,感觉比教他运行代码啥的靠谱的多
新建一个js文件,放入第三方下,客户可以登录后进行文件内容替换
const service = [
    {
        // 中文板块  镇泰
        navigation: [
            {
                title: '首页',
                href: '/'
            },
            {
                title: '公司简介',
                href: '/introduce'
            },
            {
                title: '产品介绍',
                href: '/productRound',
                children: [
                    {
                        title: '臻圆产品 ',
                        href: '/productRound'
                    }, {
                        title: '臻宠产品 ',
                        href: '/productDote'
                    }, {
                        title: '臻康产品 ',
                        href: '/null'
                    }
                ]
            },
            {
                title: '新闻中心',
                href: '/newsCenter'
            }, {
                title: '联系我们',
                href: '/aboutUs'
            }
        ]
}
]
window.service = service

 html页面中加入代码,加个随机数,后面刷新页面的时候,js能重新加载

 <script type="text/javascript">
    document.write('<script src="http://zt.zhanxuninfo.com/video/zt.js?v='+Math.random()+'"></script>');
 </script>

使用方法
console.log(JSON.stringify(window.service), 'dddddddddd');
即可使用

内容来源于网络如有侵权请私信删除

文章来源: 博客园

原文链接: https://www.cnblogs.com/aowu666/p/17347009.html

你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!