├── .browserslistrc ├── dev ├── serve.js └── serve.vue ├── .gitignore ├── babel.config.js ├── src ├── entry.js ├── entry.esm.js └── vue-intro-step.vue ├── package.json └── README.md /.browserslistrc: -------------------------------------------------------------------------------- 1 | current node 2 | last 2 versions and > 2% 3 | ie > 10 4 | -------------------------------------------------------------------------------- /dev/serve.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Dev from './serve.vue'; 3 | 4 | Vue.config.productionTip = false; 5 | 6 | new Vue({ 7 | render: (h) => h(Dev), 8 | }).$mount('#app'); 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw* 22 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | const devPresets = ['@vue/babel-preset-app']; 2 | const buildPresets = [ 3 | [ 4 | '@babel/preset-env', 5 | // Config for @babel/preset-env 6 | { 7 | // Example: Always transpile optional chaining/nullish coalescing 8 | // include: [ 9 | // /(optional-chaining|nullish-coalescing)/ 10 | // ], 11 | }, 12 | ], 13 | ]; 14 | module.exports = { 15 | presets: (process.env.NODE_ENV === 'development' ? devPresets : buildPresets), 16 | }; 17 | -------------------------------------------------------------------------------- /src/entry.js: -------------------------------------------------------------------------------- 1 | // iife/cjs usage extends esm default export - so import it all 2 | import component, * as namedExports from '@/entry.esm'; 3 | 4 | // Attach named exports directly to component. IIFE/CJS will 5 | // only expose one global var, with named exports exposed as properties of 6 | // that global var (eg. plugin.namedExport) 7 | Object.entries(namedExports).forEach(([exportName, exported]) => { 8 | if (exportName !== 'default') component[exportName] = exported; 9 | }); 10 | 11 | export default component; 12 | -------------------------------------------------------------------------------- /src/entry.esm.js: -------------------------------------------------------------------------------- 1 | 2 | // Import vue component 3 | import component from '@/vue-intro-step.vue'; 4 | 5 | // Default export is installable instance of component. 6 | // IIFE injects install function into component, allowing component 7 | // to be registered via Vue.use() as well as Vue.component(), 8 | export default /*#__PURE__*/(() => { 9 | // Get component instance 10 | const installable = component; 11 | 12 | // Attach install function executed by Vue.use() 13 | installable.install = (Vue) => { 14 | Vue.component('VueIntroStep', installable); 15 | }; 16 | return installable; 17 | })(); 18 | 19 | // It's possible to expose named exports when writing components that can 20 | // also be used as directives, etc. - eg. import { RollupDemoDirective } from 'rollup-demo'; 21 | // export const RollupDemoDirective = directive; 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-intro-step", 3 | "version": "1.0.12", 4 | "description": "基于vue2的系统引导步骤组件。", 5 | "main": "dist/vue-intro-step.ssr.js", 6 | "browser": "dist/vue-intro-step.esm.js", 7 | "module": "dist/vue-intro-step.esm.js", 8 | "unpkg": "dist/vue-intro-step.min.js", 9 | "license": "MIT", 10 | "author": { 11 | "name": "mjhu", 12 | "email": "1441901570@qq.com" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git@github.com:Mjhuu/vue-intro-step.git" 17 | }, 18 | "keywords": [ 19 | "vue", 20 | "vue-intro", 21 | "vue-intro-step", 22 | "introjs" 23 | ], 24 | "files": [ 25 | "dist/*", 26 | "src/**/*.vue" 27 | ], 28 | "sideEffects": false, 29 | "scripts": { 30 | "serve": "vue-cli-service serve dev/serve.js", 31 | "prebuild": "rimraf ./dist", 32 | "build": "cross-env NODE_ENV=production rollup --config build/rollup.config.js", 33 | "build:ssr": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format cjs", 34 | "build:es": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format es", 35 | "build:unpkg": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format iife" 36 | }, 37 | "dependencies": {}, 38 | "devDependencies": { 39 | "@babel/core": "^7.14.6", 40 | "@babel/preset-env": "^7.14.7", 41 | "@rollup/plugin-alias": "^3.1.2", 42 | "@rollup/plugin-babel": "^5.3.0", 43 | "@rollup/plugin-commonjs": "^14.0.0", 44 | "@rollup/plugin-node-resolve": "^9.0.0", 45 | "@rollup/plugin-replace": "^2.4.2", 46 | "@vue/cli-plugin-babel": "^4.5.13", 47 | "@vue/cli-service": "^4.5.13", 48 | "cross-env": "^7.0.3", 49 | "minimist": "^1.2.5", 50 | "rimraf": "^3.0.2", 51 | "rollup": "^2.52.8", 52 | "rollup-plugin-terser": "^7.0.2", 53 | "rollup-plugin-vue": "^5.1.9", 54 | "vue": "^2.6.14", 55 | "vue-template-compiler": "^2.6.14" 56 | }, 57 | "peerDependencies": { 58 | "vue": "^2.6.14" 59 | }, 60 | "engines": { 61 | "node": ">=12" 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /dev/serve.vue: -------------------------------------------------------------------------------- 1 | 83 | 84 | 123 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## vue-intro-step 2 | 3 | ### 请注意!!!这里是基于vue2版本的组件库 4 | 5 | > 基于vue2的系统步骤引导组件。 6 | > 更加便捷的操作步骤引导。 7 | > vue3版本的步骤引导组件请移步 [vue3-intro-step](https://www.npmjs.com/package/vue3-intro-step) 8 | 9 | > [vue-intro-step 求⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️](https://github.com/Mjhuu/vue-intro-step) 10 | 11 | ![vue-intro-step](https://user-images.githubusercontent.com/45823607/170439254-b1ede5b9-369b-49b1-993b-e006f5fc7034.gif) 12 | 13 | 14 | ### 安装 15 | 16 | ```shell 17 | npm i vue-intro-step --save 18 | ``` 19 | 20 | > [可选] 为了更好的使用 *vue-intro-step* 使引导组件显示、隐藏不突兀 21 | > 可以安装 animate.css 实现动画效果 22 | > ```shell 23 | > npm i animate.css --save 24 | > 25 | > # 在main.js中引入 26 | > import 'animate.css' 27 | > ``` 28 | 29 | ### 全局引用 30 | 31 | `main.js` 32 | 33 | ```js 34 | import Vue from 'vue' 35 | import VueIntroStep from 'vue-intro-step' 36 | 37 | Vue.component('vue-intro-step', VueIntroStep); 38 | 39 | ``` 40 | 41 | ### 局部引用 42 | 43 | ```vue 44 | 45 | 52 | 53 | 137 | ``` 138 | 139 | ### 自定义底部按钮 140 | 141 | ```vue 142 | 165 | 166 | 187 | ``` 188 | 189 | ## 组件参数 190 | 191 | > `v-model` 参数:控制步骤引导组件是否显示 192 | > 193 | > `config` 参数:配置步骤引导组件的参数 194 | > - `backgroundOpacity?` 参数:步骤引导组件的背景透明度,默认值为0.9,取值范围0-1 195 | > - `titleStyle?` 参数:步骤引导组件的标题样式 196 | > - `textAlign?` 参数:标题文字的居中样式,默认值为 `center`,可选值有:`left`, `center`, `right` 197 | > - `fontSize?` 参数:标题文字的字体大小样式 198 | > - `contentStyle?` 参数:步骤引导组件的内容样式 199 | > - `textAlign?` 参数:内容文字的居中样式,默认值为 `center`,可选值有:`left`, `center`, `right` 200 | > - `fontSize?` 参数:内容文字的字体大小样式 201 | > - `tips` 参数:用于盛放哪些元素需要引导 202 | > - `el` 参数:元素的选择器,切记目前只支持id选择器 203 | > - `tipPosition` 参数:引导元素提示信息的位置,可选值有:`top`, `bottom`, `left`, `right` 204 | > - `title?` 参数:引导元素提示信息的标题 205 | > - `content` 参数:引导元素提示信息的内容 206 | > - `onNext?` 参数:引导元素提示信息点击 *下一步* 按钮时的回调函数,返回一个promise,如果返回的promise成功,则继续下一步,否则不继续下一步 207 | > - `onPrev?` 参数:引导元素提示信息点击 *上一步* 按钮时的回调函数,返回一个promise,如果返回的promise成功,则继续上一步,否则不继续上一步 208 | > 209 | > `@close` 事件参数:关闭步骤引导组件时会触发的事件 210 | -------------------------------------------------------------------------------- /src/vue-intro-step.vue: -------------------------------------------------------------------------------- 1 | 56 | 57 | 262 | 263 | --------------------------------------------------------------------------------