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

可以增加一个vue-cli项目的模板吗 #33

Open
HHHJiro opened this issue May 10, 2017 · 0 comments
Open

可以增加一个vue-cli项目的模板吗 #33

HHHJiro opened this issue May 10, 2017 · 0 comments
Projects

Comments

@HHHJiro
Copy link

HHHJiro commented May 10, 2017

小白看完文档想在vue-cli的项目使用 mditor 发现报错
我在vue-cli 项目的index.html中引入

   <!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>oscweb</title>
    <link rel="stylesheet" type="text/css" href="/static/css/mditor.min.css">
  </head>
  <body>
    <div id="app"></div>
    <!-- built files will be auto injected -->
		<script type="text/javascript" src="/static/js/mditor.min.js"></script>
  </body>
</html>

在使用的时候

    mounted () {
      this.$nextTick(function () {
        var mditor = Mditor.fromTextarea(document.getElementById('editor'))
        mditor.on('ready', function () {
          console.log(mditor.value)
          mditor.value = '** hello **'
        })
      })
    }

控制台告知我Mditor not defined
然后我通过npm 安装 mditor
在.vue文件中

import Mditor from 'mditor'

控制台输出信息

[Vue warn]: Error in nextTick: "TypeError: __WEBPACK_IMPORTED_MODULE_0_mditor___default.a.fromTextarea is not a function"

found in

---> <AddRes> at C:\git\OSCourse\oscweb\src\components\add_res.vue
       <App> at C:\git\OSCourse\oscweb\src\App.vue
         <Root>
  • 希望知道如何在vue项目中使用mditor
  • 希望可以增加一个vue项目使用的demo
@Houfeng Houfeng added this to 1 in mditor Jun 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant