Skip to content

Commit

Permalink
fix: package name update
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgx committed Dec 7, 2022
1 parent ff9f9d4 commit 91f3a3a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
#### Installtion

```bash
npm i use-dnamic-mount
npm i use-dynamic-mount
```

#### Usage

```js
import Vue from "vue";
import useDnamicMount from "use-dnamic-mount";
import useDynamicMount from "use-dynamic-mount";

Vue.use(useDnamicMount(), {
Vue.use(useDynamicMount(), {
name: "$toast",
extend: {
data: () => ({ message: "" }),
Expand All @@ -29,10 +29,10 @@ this.$toast({ message: "hello world" });

| 参数名 | 说明 | 类型 | 默认值 |
| --------- | -------------------- | ------ | -------------- |
| name | 方法名 | String | $dnamicMount |
| name | 方法名 | String | $dynamicMount |
| extend | 挂载的组件 (必填) | VNode | - |
| nextTick | 挂载后的回调 | Function | - |
| className | 挂载节点自定义 class | String | dnamic-element |
| className | 挂载节点自定义 class | String | dynamic-element |


#### Example
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
</div>
<div id="message-app"></div>
<script>
const dnamicMount = useDnamicMount();
Vue.use(dnamicMount, {
const dynamicMount = useDynamicMount();
Vue.use(dynamicMount, {
name: "$message",
extend: {
data: () => ({ text: "" }),
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "use-dnamic-mount",
"name": "use-dynamic-mount",
"version": "1.0.0",
"main": "dist/index.esm.js",
"module": "dist/index.esm.js",
Expand All @@ -12,7 +12,8 @@
"rollup-plugin-terser": "7.0.2"
},
"keywords": [
"dnamic mount",
"dynamic mount",
"dynamic mount vue component",
"动态挂载vue组件"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default [
{
input: "src/main.js",
output: {
name: "useDnamicMount",
name: "useDynamicMount",
file: pkg.browser,
format: "umd",
},
Expand Down
8 changes: 4 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export default () => ({
install(Vue, config = {}) {
const {
name = "$dnamicMount",
className = "dnamic-element",
name = "$dynamicMount",
className = "dynamic-element",
extend,
nextTick,
} = config;
if (!extend) return;
Vue.prototype[name] = (options) => {
const DnamicComponentConstructor = Vue.extend(extend);
const app = new DnamicComponentConstructor({
const DynamicComponentConstructor = Vue.extend(extend);
const app = new DynamicComponentConstructor({
data: () => ({
...options,
destroy: () => {
Expand Down

0 comments on commit 91f3a3a

Please sign in to comment.