Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in gogocode-plugin-vue 转化有亿点问题: 2.没有转化new Vue #47

Closed
masx200 opened this issue Jul 22, 2021 · 6 comments
Closed

Comments

@masx200
Copy link

masx200 commented Jul 22, 2021

1.没有转化new VueRouter(已经解决)
2.没有转化new Vue
3.少了一句话Vue.use(VueRouter);(已经解决)
应该改成app.use(router)(已经解决)

gogocode -s ./src/index.ts -t gogocode-plugin-vue -o ./src-out/index.ts

index.ts

import "./styles.ts";
//@ts-ignore
import { initloadingid } from "./initloadingid.ts";
import "./error-alert.js";
import VueRouter from "vue-router";
//@ts-ignore
// import SimpleStoreManager from "@masx200/vue-simple-global-state-store-manager"; // bindGlobalStore // initGlobalState,
import Vue from "vue";
import "@masx200/webpack-react-vue-spa-awesome-config/registerserviceworker.js";

// import "webpack-react-vue-spa-awesome-config/ie11babelpolyfill";
("use strict");
const rootele =
    document.getElementById("root") ||
    document.body.appendChild(document.createElement("div"));
Object.assign(rootele, { id: "root" });
if (!document.getElementById("app")) {
    rootele &&
        (rootele.innerHTML = `<div id=${initloadingid}>
<h1>loading</h1>
<span class="mui-spinner mui-spinner-custom">

</span></div>`);
}
// eslint-disable-next-line no-undef

window.addEventListener(
    "load",
    () => {
        //   import("bootstrap/dist/js/bootstrap.bundle");
        import("clipboard").then((module) => {
            const ClipboardJS = module.default;
            new ClipboardJS(".btn").on("success", function (e) {
                e.clearSelection();
            });
        });
    },
    { once: true }
);

Vue.config.productionTip = false;
Vue.config.silent = true;
Vue.config.devtools = true;
Vue.use(VueRouter);
// console.log(SimpleStore);
// Vue.use(SimpleStoreManager);
Vue.config.errorHandler = function (err, vm, info) {
    throw err;
};
import("./vue-index-render.js").then(({ router, default: AppHome }) => {
    const container =
        document.getElementById("app") ||
        rootele.appendChild(document.createElement("div"));
    Object.assign(container, { id: "app" });
    // var AppHome=default
    const vm = new Vue({
        router,

        render(h) {
            return h(AppHome);
        },
    });
    rootele && vm.$mount(container);
    Object.assign(vm.$el, {
        id: "app",
    });
});

index.ts

import '@masx200/webpack-react-vue-spa-awesome-config/registerserviceworker.js'
import * as Vue from 'vue'
import * as VueRouter from 'vue-router'
import './error-alert.js'
//@ts-ignore
import { initloadingid } from './initloadingid.ts'
import './styles.ts'

// import "webpack-react-vue-spa-awesome-config/ie11babelpolyfill";
;('use strict')
const rootele =
  document.getElementById('root') ||
  document.body.appendChild(document.createElement('div'))
Object.assign(rootele, { id: 'root' })
if (!document.getElementById('app')) {
  rootele &&
    (rootele.innerHTML = `<div id=${initloadingid}>
<h1>loading</h1>
<span class="mui-spinner mui-spinner-custom">

</span></div>`)
}
// eslint-disable-next-line no-undef

window.addEventListener(
  'load',
  () => {
    //   import("bootstrap/dist/js/bootstrap.bundle");
    import('clipboard').then((module) => {
      const ClipboardJS = module.default
      new ClipboardJS('.btn').on('success', function (e) {
        e.clearSelection()
      })
    })
  },
  { once: true }
)

window.$vueApp.config.silent = true
window.$vueApp.config.devtools = true
// console.log(SimpleStore);
// Vue.use(SimpleStoreManager);
window.$vueApp.config.errorHandler = function (err, vm, info) {
  throw err
}
import('./vue-index-render.js').then(({ router, default: AppHome }) => {
  const container =
    document.getElementById('app') ||
    rootele.appendChild(document.createElement('div'))
  Object.assign(container, { id: 'app' })
  // var AppHome=default
  const vm = new Vue({
    router,

    render() {
      return Vue.h(AppHome)
    },
  })
  rootele && vm.$mount(container)
  Object.assign(vm.$el, {
    id: 'app',
  })
})

@masx200

This comment has been minimized.

@wudi3
Copy link
Member

wudi3 commented Jul 22, 2021

重新执行下面命令即可
gogocode -s ./src/index.ts -t gogocode-plugin-vue -o ./src-out/index.ts

gogocode-plugin-vue 自动更新至 1.0.12

@masx200
Copy link
Author

masx200 commented Jul 22, 2021

还有这两句话没删掉 @wudi3

Vue.config.silent = true;
Vue.config.devtools = true;

@masx200
Copy link
Author

masx200 commented Jul 22, 2021

这句话还是没转化? @wudi3

const vm = new Vue({
    router,

    render() {
      return Vue.h(AppHome)
    },
  })

@wudi3
Copy link
Member

wudi3 commented Jul 27, 2021

重新执行下面命令即可
gogocode -s ./src/index.ts -t gogocode-plugin-vue -o ./src-out/index.ts

gogocode-plugin-vue 自动更新至 1.0.13

@masx200 masx200 closed this as completed Jul 27, 2021
@masx200 masx200 reopened this Jul 27, 2021
@masx200
Copy link
Author

masx200 commented Jul 27, 2021

使用了gogocode-plugin-vue 1.0.13之后变成这样了?

import './styles.ts'
//@ts-ignore
import { initloadingid } from './initloadingid.ts'
import './error-alert.js'
import * as VueRouter from 'vue-router'
import * as Vue from 'vue'
import '@masx200/webpack-react-vue-spa-awesome-config/registerserviceworker.js'

// import "webpack-react-vue-spa-awesome-config/ie11babelpolyfill";
;('use strict')
const rootele =
  document.getElementById('root') ||
  document.body.appendChild(document.createElement('div'))
Object.assign(rootele, { id: 'root' })
if (!document.getElementById('app')) {
  rootele &&
    (rootele.innerHTML = `<div id=${initloadingid}>
<h1>loading</h1>
<span class="mui-spinner mui-spinner-custom">

</span></div>`)
}
// eslint-disable-next-line no-undef

window.addEventListener(
  'load',
  () => {
    //   import("bootstrap/dist/js/bootstrap.bundle");
    import('clipboard').then((module) => {
      const ClipboardJS = module.default
      new ClipboardJS('.btn').on('success', function (e) {
        e.clearSelection()
      })
    })
  },
  { once: true }
)

window.$vueApp.config.silent = true
window.$vueApp.config.devtools = true
// console.log(SimpleStore);
// Vue.use(SimpleStoreManager);
window.$vueApp.config.errorHandler = function (err, vm, info) {
  throw err
}
import('./vue-index-render.js').then(({ router, default: AppHome }) => {
  const container =
    document.getElementById('app') ||
    rootele.appendChild(document.createElement('div'))
  Object.assign(container, { id: 'app' })
  // var AppHome=default
  const vm = (window.$vueApp = Vue.createApp())
  window.$vueApp.config.globalProperties.routerAppend = (
    path,
    pathToAppend
  ) => {
    return path + (path.endsWith('/') ? '' : '/') + pathToAppend
  }
  window.$vueApp.use(router)
  rootele && vm.$mount(container)
  Object.assign(vm.$el, {
    id: 'app',
  })
})

为什么这句话没了?

{
render() {
      return Vue.h(AppHome)
    },}

@masx200 masx200 changed the title bug in gogocode-plugin-vue 转化有亿点问题:1.没有转化new VueRouter 2.没有转化new Vue 3.少了一句话Vue.use(VueRouter); bug in gogocode-plugin-vue 转化有亿点问题: 2.没有转化new Vue Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants