export default {
name: "HelloWorld",
data () {
return {}
}
}
text();
function text(){
//datamsg
}
export default {
name: "HelloWorld",
data () {
return {}
}
}
text();
function text(){
//datamsg
}
as far as I know, it is not allowed.
because your export default is just a class, not an instantiated VM.
unless this is an instantiated vm, you can. Since your component is not a top-level element, it is recommended to manage it in vuex.
if you are sure you want to do it this way, my advice is this:
// sub-app.js
export default new Vue({
el: '-sharpsub-app'
name: 'HelloWorld',
data () {
return {}
}
})
//
import SubApp from '../subApp.vue'
text();
function text(){
SubApp.$data.msg = 'new msg'
}
what is the scenario of such a requirement?
generally uses data in data
in templates.
<template>
<div>
{{msg}}
</div>
</template>
this event is either the method defined in methods, where you can also operate this.a to access the assignment directly
var vm = new Vue({
data: { a: 1 },
methods: {
plus: function () {
this.aPP
}
}
})
vm.plus()
or the official website: vm.$data
var vm = new Vue({
data: data
})
vm.a // => 1
vm.$data === data
Environment, version: node: 8.9.3 webpack: 3.6.0 vue: 2.2.2 vue-cli: 2.x webpack is a template that uses vue-cli. After packaging, an error is displayed on the WeChat end of ios, while Android is fine: prompt that there is an error ...
beginners, initialize the project with vue-cli and webpack, now want to introduce a non-modular js file, this file has the following characteristics: wants to make global references, such as the js file in the css library there is no need to modi...
Agent has been configured ip404 ...
recently contacted vue, to use vue to make a similar style website (as shown below), and the actual demand is estimated to be 20 + pages visually. Can a single page be satisfied? because I haven t used vue, I worry that when using a single page, ...
Project built with vue-cli3.0, which is the directory structure npm run build index3.0 babel.config.js ...
main.js .vue how should I introduce jquery is set ...
has been solved, and the production environment does not need babel-loader I don t know when and who added this dependency in the production environment an old project has not been maintained for a long time. Today, after clone comes down, npm ...
create projects using vue-cli3.x scaffolding how can I use other UI frameworks or libraries in single-file vue components? such as jQuery, Layui, Bootstrap. I try to add a resource reference directly to public index.html , add the road strength p...
nuxt s document is cli2. Now that cli3 is out, how can I initialize it with @ vue cli 3? ...
I recently upgraded to vue-cli3, and found that when I found serve or build, I would give priority to the contents in the cache, which caused me to modify the common method and pack up exactly the same content as before. I know that the cache file cor...
When starts for the first time, this network is a non-local address. I would like to know where to modify the function and configuration of this network? I looked through the official documentation and couldn t find the instructions for configuring ...
in my vue project static js country_region.js this file is imported into a .vue file to be used as a drop-down list but my website is multilingual, all introduced i18n, but $t () this syntax can only be used in .vue, how can I use it in this js ...
projects created using vue-cli 2.9 config index.js this.$http .post(" UTRY tsupport_workbench rest loginCtrl getMenu") restart and delete node_modules have all been tried, and there is no sign of proxy. console or cross-domain repor...
< H2 > problem description < H2 > vue-cli3.0 opens blank space on pc and can be opened normally on Android ios in browser Wechat on pc does not seem to support es6 syntax < H2 > the environmental background of the problem and what methods you have ...
template code methods:{ onMouseDown:(e)=>{ let count = 0; this.inDragging = true; this window.addEventListener( mousemove ,this.onDragging); }, } ...
problem description websocket, this.socketApi.controlsendSock(controlData) js websocket2 the environmental background of the problems and what methods you have tried related codes Please paste the code text below (do not replace the code with...
for example: a project in which a vue file has two implementations for different customers. Now you want to configure it, enter different commands when packaging, package the corresponding files, and achieve the function. ...
problem description vue2.9.6 init s project npm start failed: npm run dev vuecli_demo@1.0.0 dev E:usualcodevuecli_demo webpack-dev-server-inline-progress-config build webpack.dev.conf.js E:usualcodevuecli_demobuildutils.js:85 exports.createNo...
< van-tabs VMI model = "active " animated @ click= "onClick " > <van-tab v-for="(item,index) in dome" :title="item.test" :key="index" >< van-tab> < van-tabs > The tabs event parameter in vant is...
:node v11.6.0npm 6.5.0vue cli 3.3.0 demo, 7nz < H1 > final solution: < H1 > rm -fr node_modules package-lock.json npm install npm run serve Note: yarn install can also solve this problem ...