Answer the question
In order to leave comments, you need to log in
How to use a template multiple times?
Installed Vue, vueify, browserify via node.
There is main.js (entry point):
var Vue = require('vue');
var quality = require('./componets/quality.vue');
new Vue({
el: '#qua',
render: function(createElement) {
return createElement(quality)
},
})
<template>
<div class="qua-item">
<div class="qi-img qi-img1"></div>
<div class="separator"></div>
<div class="qi-text-head"></div>
<div class="qi-text">Excepteur sinto occaecat cupidatat non proident, sunt in culpa qui nam sint essent officia mollit.</div>
</div>
</template>
module.exports = {
data: function(){
return {
items: [
{
name: '123',
},
{
name: '321',
}
],
}
}
}
<div id="qua"></div>
<div id="qua"></div>
Answer the question
In order to leave comments, you need to log in
I can’t solve the problem itself at the root, but there is a workaround (maybe it’s correct, but I didn’t want it), as I did (everything inside the * .vue file):
<template>
<div class="qua-item-list">
<div class="qua-item" v-for="item in items">
<div class="qi-img qi-img1">{{ item.name }}</div>
<div class="separator"></div>
<div class="qi-text-head">{{ item.status }}</div>
<div class="qi-text">Excepteur sinto occaecat cupidatat non proident, sunt in culpa qui nam sint essent officia mollit.</div>
</div>
</div>
</template>
module.exports = {
data: function(){
return {
items: [
{
name: '123', status: 'done!',
},
{
name: '321', status: 'done!',
}
],
}
}
}
Use components.
https://ru.vuejs.org/v2/guide/components.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question