我是日本人,英语不好对不起。
我使用的是vue-cli3.1。
我想在ie11上使用这个模块。https://github.com/holiber/sl-vue-tree
上面说你可以在ie11上和一起使用。
但我不能正确地使用巴别-波菲尔。
我做了“纱加了@babel/Poly填充”。
在main.ts的顶部,我导入了它。
但没起作用。
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');<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>发布于 2019-07-05 07:04:37
我就是这样解决的。我使用Vue cli 3.6和sl tree 1.8.4
将transpileDependencies添加到vue.config.js
module.exports = {
transpileDependencies: ['sl-vue-tree'],
...
}我的babel.config.js
module.exports = {
presets: [
["@vue/app", {
modules: "commonjs"
}]
]
};在我的vue组件中,我只是像这样导入sl树:
import slVueTree from "sl-vue-tree";https://stackoverflow.com/questions/53100593
复制相似问题