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

郑州市住房和城乡建设厅网站网站右下角广告代码

郑州市住房和城乡建设厅网站,网站右下角广告代码,wordpress 通知,怎么用手机做网站打造自己的前端组件库 demo是开源的,自己上npm 或者 github 上都能搜到 新建vue项目(sass js vue2) vue create yt-ui 修改文件目录(如下) 修改: 1.src 更名 examples; 2. src/components移动到项目最外层;3.vue.config.js更改入口文件 /…

打造自己的前端组件库

demo是开源的,自己上npm 或者 github 上都能搜到

新建vue项目(sass + js + vue2)

vue create yt-ui	

修改文件目录(如下)

在这里插入图片描述

修改: 1.src 更名 examples; 2. src/components移动到项目最外层;3.vue.config.js更改入口文件

// vue.config.js
const {defineConfig} = require('@vue/cli-service')
module.exports = defineConfig({transpileDependencies: true,pages: {index: {entry: 'examples/main.js',template: 'public/index.html',filename: 'index.html'}}
})

编写ytDemo组件并在app.vue中使用

在这里插入图片描述

新建文件目录结构如上图:

 // components/demo/index.jsimport ytDemo from "./src/main.vue";ytDemo.install = (Vue) => {Vue.component(ytDemo.name, ytDemo);};export default ytDemo;// components/src/main.vue<!--* @Description: main 页面* @Author: mhf* @Date: 2023/10/21--><template><div><div class="a">a<div class="b">b</div></div></div></template><script>export default {name: "ytDemo",components: {},props: {},computed: {},watch: {},filters: {},data() {return {};},methods: {},created() {},mounted() {},destroyed() {},};</script><style lang="scss" scoped>.a {width: 200px;height: 200px;border: 1px solid red;.b {width: 100px;height: 100px;border: 1px solid green;}}</style>// example/main.jsimport Vue from 'vue'import App from './App.vue'import ytDemo from "../components/ytDemo";Vue.use(ytDemo)Vue.config.productionTip = falsenew Vue({render: h => h(App),}).$mount('#app')

根据如上步骤则出现如下效果
在这里插入图片描述


打包

// components/index.js// 整个包的入口
// 统一导出
import ytComp from "./ytComp";
import ytDemo from "./ytDemo";
const components = [ytComp,ytDemo,
]
// 定义install方法
const install = function (Vue) {// 注册所有的组件components.forEach(component => {Vue.component(component.name, component)})
}
// 判断是否直接引入文件,如果是,就不用调用Vue.use()
if (typeof window !== 'undefined' && window.Vue) {install(window.Vue)
}
// 导出install方法
export default {install,ytDemo,ytComp
}// package.json
{"name": "@mhfwork/yt-ui", // 必须保持唯一(请自行上npm官网查询自己的项目名称)"version": "0.0.1","private": false,"author": {"name": "毛三仙","email": "mhf.mail@qq.com"},"scripts": {"serve": "vue-cli-service serve","build": "vue-cli-service build","lint": "vue-cli-service lint","format": "prettier --write \"components/**/*.js\" \"components/**/*.vue\" \"examples/**/*.vue\" \"examples/**/*.vue\"","lib": "vue-cli-service build --target lib components/index.js"},"dependencies": {"core-js": "^3.8.3","vue": "^2.6.14"},"devDependencies": {"@babel/core": "^7.12.16","@babel/eslint-parser": "^7.12.16","@vue/cli-plugin-babel": "~5.0.0","@vue/cli-plugin-eslint": "~5.0.0","@vue/cli-service": "~5.0.0","eslint": "^7.32.0","eslint-plugin-vue": "^8.0.3","sass": "^1.32.7","sass-loader": "^12.0.0","vue-template-compiler": "^2.6.14"},"eslintConfig": {"root": true,"env": {"node": true},"extends": ["plugin:vue/essential","eslint:recommended"],"parserOptions": {"parser": "@babel/eslint-parser"},"rules": {}},"browserslist": ["> 1%","last 2 versions","not dead"]
}

发布流程

todo: 更新 readeMe.md、package.json版本号   1. npm run lib   2. npm get registry 3. npm login     					// 登陆自己的npm账号,没有请自行注册4. npm publish --access public		// 正常的话 npm publish 即可,因本项目中使用@mhfwork/xxx 需注明是public库

使用发布成功的组件库
在这里插入图片描述

新项目中

npm i @mhfwork/yt-ui
main.js中注册	import ytComp from "@mhfwork/yt-ui/components/ytComp";import ytDemo from "@mhfwork/yt-ui/components/ytDemo";Vue.use(ytComp)Vue.use(ytDemo)	

Vue文件中使用

<template><div class="home"><yt-comp page-name="aaahahah"/><yt-demo /></div>
</template><script>
// @ is an alias to /srcexport default {name: 'HomeView',components: {}
}
</script>
http://www.15wanjia.com/news/190888.html

相关文章:

  • 网站建设网站系统选择软文推广多少钱一篇
  • .net网站设计做网站要几个人
  • wordpress采集微信文章内容seo是免费的吗
  • 国内免费可商用图片素材网站泰州seo网站推广
  • 化工行业网站设计wordpress网站文件目录
  • 欧美做爰爰爰爰网站网站开发方面知识
  • 阿里云虚拟主机怎么建立网站展览设计工程有限公司
  • 建设网站的教程百姓网如何创建位置
  • php做的网站首页是什么文件夹长治网站制作平台
  • 怎样在手机上建设网站如何建立网站快捷
  • 网站建设平台选用及分析临沂市开发区可以做分销的网站
  • 网站更换运营商要重新备案嘉兴 企业网站 哪家
  • 怎么自己在电脑上做网站中文网站域名注册
  • 最新免费网站源码资源网站江苏网站建设方案
  • 专业网站开发平台网站直接跳转
  • 卖表网站源码珠海网站制作哪家好
  • 网站建设行业新闻成都创信互联科技有限公司
  • 原版百度湖南seo推广
  • 建个企业网站要多少钱滨州j建设局网站投诉电话
  • 网站建设竞价托管外包国家反诈中心app下载
  • 手机网站需要域名吗连云港优化网站团队
  • 网站建设与管理代码广西人才市场职称网
  • 深圳微网站制作wordpress分类目录404
  • python可以做网站后台吗python基础教程答案
  • 太原网站建设ty556分享此博文wordpress
  • 网站建设到运营需要多少钱wordpress storefront
  • 建立网站需要什么手续学校培训网站建设
  • 商务公司网站建设陕西住房和城乡建设厅网站
  • 海口网站建设方案策划网站字体特效
  • 建筑劳务东莞网站建设WordPress大前端DUX5.1