首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ie11上的sl-vue-tree + vue-cli3.1

ie11上的sl-vue-tree + vue-cli3.1
EN

Stack Overflow用户
提问于 2018-11-01 11:41:51
回答 1查看 350关注 0票数 0

我是日本人,英语不好对不起。

我使用的是vue-cli3.1。

我想在ie11上使用这个模块。https://github.com/holiber/sl-vue-tree

上面说你可以在ie11上和一起使用。

但我不能正确地使用巴别-波菲尔。

我做了“纱加了@babel/Poly填充”。

在main.ts的顶部,我导入了它。

但没起作用。

代码语言:javascript
复制
import "@babel/polyfill"

import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';

Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount('#app');
代码语言:javascript
复制
<template>
  <div class="about">
    <h1>This is an about page</h1>
    <SlVueTree v-model="treeModel">

    </SlVueTree>
  </div>
</template>
<script lang="ts">
import { Component, Vue } from "vue-property-decorator";

//sl-vue-tree
import SlVueTree from "sl-vue-tree-original";


@Component({
  components: {
    SlVueTree
  }
})
export default class About extends Vue {

  public treeModel = [
    {
        "title": "Item1",
        "isLeaf": true
    },
    {
        "title": "Item2",
        "isLeaf": true
    },
    {
        "title": "Folder1",
        "isExpanded": true,
        "children": [
            {
                "title": "Item3",
                "isLeaf": true
            },
            {
                "title": "Item4",
                "isLeaf": true
            },
            {
                "title": "Folder2",
                "children": [
                    {
                        "title": "Item5",
                        "isLeaf": true
                    }
                ]
            }
        ],
        "isSelected": true
    },
    {
        "title": "Item6",
        "isLeaf": true
    }
];

  }
}
</script>
EN

回答 1

Stack Overflow用户

发布于 2019-07-05 07:04:37

我就是这样解决的。我使用Vue cli 3.6和sl tree 1.8.4

将transpileDependencies添加到vue.config.js

代码语言:javascript
复制
module.exports = {
 transpileDependencies: ['sl-vue-tree'],
 ...
}

我的babel.config.js

代码语言:javascript
复制
module.exports = {
 presets: [
  ["@vue/app", {
    modules: "commonjs"
  }]
 ]
};

在我的vue组件中,我只是像这样导入sl树:

代码语言:javascript
复制
import slVueTree from "sl-vue-tree";
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53100593

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档