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

提升网站浏览量centos7 wordpress无权限

提升网站浏览量,centos7 wordpress无权限,wordpress08模板,软件开发是什么工作发布一个简单的npm包 首先创建一个文件夹#xff08;唯一的命名#xff09;创建package.json包#xff0c;输出npm init#xff0c;一直回车就好。创建index.js文件#xff0c;向外暴露方法。 将包上传或更新到 npm 执行登录命令#xff1a;npm login 登录npm官网…发布一个简单的npm包 首先创建一个文件夹唯一的命名创建package.json包输出npm init一直回车就好。创建index.js文件向外暴露方法。 将包上传或更新到 npm  执行登录命令npm login 登录npm官网根据提示输入用户名和密码邮箱邮箱必须在注册时进行验证 发布版本在登陆命令后接着输入如下命令 npm publish 发布上传后你可以去 npm 官网上查一下自己的包有没有存在。 在项目中安装你的包 npm i xxx -s在main.js中引用 在vue项目任何页面使用 发布一个自己组件包 1、在项目中添加组件库文件夹 在根目录下新建一个plugins文件夹用来放组件项目文件结构为  我的是跟src平级 创建plugins组件文件夹 2、添加配置文件 项目根目录下面添加vue.config.js文件写入以下内容主要是配置webpack的打包 3、编写组件 把封装的组件、封装的指令和封装的过滤器每个都写在分类文件夹中后面在合理添加并继续封装。下面我以datetime这个组件为例是一个时间显示组件 建组件date-time.vue和单独暴露组件的index.js文件 date-time.vue内容如下 templatediv classdate-time :style{ font-size: ${useStyleObj.fontSize}px }p :stylestyleObject{{ nowDate }}/pp :stylestyleObject{{ nowTime }}/p/div /template script export default {name: dateTime,props: {styleObj: {//客户端传递的样式type: Object,default: () ({fontSize: 25,color: [#dcedff, #5ca9ff]})}},computed: {useStyleObj() {//用computed是为了暴露客户端的styleObj样式属性值可以选填更加灵活let size 25;let color [#dcedff, #5ca9ff];if (this.styleObj.fontSize) {size this.styleObj.fontSize;}if (this.styleObj.color) {color this.styleObj.color;}return {fontSize: size,color: color};},styleObject() {//根据客户端传递的样式值配置文字的渐变色return {background: linear-gradient(180deg,${this.useStyleObj[color][0]},${this.useStyleObj.color.length 1? this.useStyleObj[color][1]: this.useStyleObj[color][0]}),-webkit-background-clip: text};}},data() {return {timer: null,nowWeek: ,nowDate: ,nowTime: // styleBox: {}};},created() {this.timer setInterval(() {this.setNowTimes();}, 1000); //时间},beforeDestroy: function() {if (this.timer) {clearInterval(this.timer);}},methods: {setNowTimes() {//时间拼接方法const myDate new Date();const wk myDate.getDay();const yy String(myDate.getFullYear());const mm myDate.getMonth() 1;const dd String(myDate.getDate() 10 ? 0${myDate.getDate()} : myDate.getDate());const hou String(myDate.getHours() 10 ? 0${myDate.getHours()} : myDate.getHours());const min String(myDate.getMinutes() 10? 0${myDate.getMinutes()}: myDate.getMinutes());const sec String(myDate.getSeconds() 10? 0${myDate.getSeconds()}: myDate.getSeconds());const weeks [周日, 周一, 周二, 周三, 周四, 周五, 周六];const week weeks[wk];this.nowDate ${yy}/${mm}/${dd} ${week};this.nowTime ${hou}:${min}:${sec};this.nowWeek week;}} }; //样式文件 /script style langscss scoped/styleindex.js文件内容为组件提供 install 方法供组件对外按需引入 import dateTimes from ./date-time.vue;dateTimes.install Vue Vue.component(dateTimes.name, dateTimes); //注册组件export default dateTimes;这个单独暴露组件的 index.js意思是如果这个工程值封装一个组件使用的话就用这个index.js 文件暴露 install 即可了。  plugins 文件夹下面新建一个 index.js 文件为了统一导出所有组件及暴露 install 方法。之前的 index.js 只是安装单个组件而现在这个 index.js 是循环安装所有组件、所有指令、过滤器统一暴露出去可以按需引用组件此时plugins文件夹的内容为 我这里是统一暴露组件、指令、过滤器 //组件 import DateTime from ./components/dateTime/date-time.vue//所有组件列表 const components [DateTime]//定义install方法Vue作为参数 const install Vue {//判断是否安装安装过就不用继续执行if (install.installed) returninstall.installed true//遍历注册所有组件components.map(component Vue.component(component.name, component)) }//检测到Vue再执行 if (typeof window ! undefined window.Vue) {install(window.Vue); } export default {install,//所有组件必须具有install方法才能使用Vue.use()...components }4、在本地页面中使用组件 在main.js中引入 在页面中不用引入使用使用组件因为是全局注册了组件库所以可以直接使用标签这个标签与组件文件中的date-time.vue里的name保持一致只不过一个是驼峰式写法一个是标签名称。 测试可以全局使用组件说明封装的组件没有问题下面可以打包了。 5、打包 在package.json文件中的scripts字段里添加以下内容 scripts: {serve: vue-cli-service serve,build: vue-cli-service build,lib: vue-cli-service build --target lib --name 包名 -dest lib plugins/index.js,lint: vue-cli-service lint},因为在vue-cli中可以通过以下命令将一个单独的入口打包成库 // target: 默认为构建应用改为 lib 即可启用构建库模式 // name: 输出文件名 // dest: 输出目录默认为 dist这里我们改为 lib // entry: 入口文件路径 vue-cli-service build --target lib --name lib [entry] package.json中配置打包信息 .gitignore文件中添加把包的一些测试文件过滤掉最终打包只留下直接封装的文件即plugins中封装的暴露组件 在终端执行npm run lib 即可执行结果 6、发布包 7、使用包 npm i xgs_common -s 在项目文件mainjs中引入。 在项目中直接使用组件中的name即可 例如date-time/
http://www.pierceye.com/news/588590/

相关文章:

  • 推广网官方推广网站wordpress用户角色权限
  • 电子商务网站模板html淘宝网页版登录
  • 忆达城市建设游戏网站佛山市和城乡建设局网站
  • 备案后的域名改网站名青浦建设机械网站
  • 网站地图怎么做html网络营销论文2000字
  • 武进区城乡建设局网站组建网站建设团队
  • 做淘宝链接模板网站广安网站建设兼职
  • 受欢迎的网站建设平台有用的网站地址
  • 网站建设推广岗位网站建设法规
  • ftp两个网站子域名的绑定郑州网站推广公司
  • 安庆网站设计哈尔滨工程招标信息网
  • 精湛的佛山网站设计太原网站建设培训
  • 邹城市住房和建设局网站深圳比较好的vi设计公司
  • 企业网站建设维护方案一元购物网站怎么做
  • 网站建设优化公司哪家好兰州做网站公司es5188
  • jsp网站开发工资住建网查询
  • 长沙建网站需要多少钱夹江移动网站建设
  • 淄博网站制作高端网站后台任务
  • 营销型网站源码成都网站建设seo
  • 天津网上商城网站建设专业的猎头公司
  • 西平县住房城乡建设局网站西部数码网站管理助手3.0
  • 承德市网站建设WordPress电影资源分享下载站
  • 专注于网络推广及网站建设wordpress离线发布功能
  • 营销型网站案例提高wordpress打开速度
  • 怎么样做一个网站自己个人网站后台怎么做
  • 源码站免费找客户网站
  • idc空间商网站源码知名的网站建设
  • 什么叫网站降权建设网站租服务器
  • 网站后台模板怎样使用站长平台
  • 写一个app需要多少钱龙岩seo包年系统排行榜